home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / Empty.adf / SuperBaseDBL.doc < prev    next >
Text File  |  1992-02-07  |  228KB  |  8,250 lines

  1.             SUPERBASE PROFESSIONAL
  2.              DATABASE MANAGEMENT LANGUAGE
  3.                  USER GUIDE
  4.  
  5. BEFORE YOU BEGIN...
  6.  
  7. This Volume presents you with two user guides,one for Superbase's Database
  8. Management Language (DML) and one for the Forms Editor. Although they are
  9. both under the same cover, they can be treated as separate manuals. Each
  10. has its own Contents, Index, chapter numbers and page numbers.
  11.  
  12. Note that the Forms Editor is a separate program from Superbase
  13. Professional. You will find instructions on how to install and load it on
  14. your computer in the Readme document which is supplied on the demonstration
  15. file disk. If you haven't done so already, you should read this document
  16. now. It also provides details of any features of Superbase Professional
  17. that are not covered in either Volume 1 or 2.
  18.  
  19.                 i
  20.  
  21. DML USER GUIDE
  22. CONTENTS
  23.  
  24. CHAPTER 1
  25. INTRODUCTION TO DML                        1-1
  26. Using this guide                        1-1
  27. CHAPTER 2        
  28. OVERVIEW                            2-1
  29. Operating Modes                            2-1
  30. Keywords and Reserved Words                    2-1
  31. Commands and Statements                        2-2
  32. Variables                            2-2
  33. File Types                            2-4
  34. Fields                                2-5
  35. Date and Time                            2-6
  36. Functions                            2-6
  37. Operators                            2-7
  38. Constants                            2-13
  39. Expressions                            2-14
  40. Line Format and Labels                        2-14
  41. Syntax                                2-15
  42. CHAPTER 3
  43. THE PROGRAM EDITOR                        3-1
  44. Creating a New Program                        3-3
  45. Editing a Program                        3-4
  46. Using the Command Line                        3-6
  47. Loading a Program                        3-7
  48. Saving a Program                        3-7
  49. Running a Program                        3-8
  50. Creating a Start Up Program                    3-8
  51. CHAPTER 4
  52. FUNCTION KEYS                            4-1
  53. Setting a Function Key                        4-1
  54. Function Keys for Commands                    4-2
  55. Functions Keys for Text and Program Entry            4-3
  56.  
  57.                 ii
  58.  
  59. Editing a Function Key String                    4-4
  60. Function Key Files                        4-5
  61. CHAPTER 5
  62. KEYWORD REFERENCE GUIDE                        5-1
  63. Syntax Conventions                        5-1
  64. ? Commands                            5-3
  65. ?                                5-8
  66. ? DIRECTORY                            5-9
  67. ? LIST                                5-9
  68. ? MEMORY                            5-10
  69. ? QUERY                                5-10
  70. ? STATUS                            5-11
  71. ? TEXT                                5-12
  72. ABS                                5-13
  73. ADD                                5-14
  74. AFTER GROUP                            5-17
  75. AFTER REPORT                            5-18
  76. ASC                                5-18
  77. ASK                                5-19
  78. ATN                                5-20
  79. BEFORE GROUP                            5-21
  80. BELL                                5-22
  81. BLANK                                5-22
  82. BREAK                                5-23
  83. CALL                                5-24
  84. CHAIN                                5-24
  85. CHR$                                5-24
  86. CLEAR                                5-26
  87. CLOSE                                5-26
  88. CLOSE FIELDS                            5-27
  89. CLOSE FILE                            5-28
  90. CLOSE FORM                            5-28
  91. CLS                                5-29
  92. COL                                5-29
  93. COPY                                5-30
  94. COS                                5-30
  95. CREATE                                5-31
  96. CREATE INDEX                            5-32
  97. DATA                                5-33
  98. DATE$                                5-34
  99. DATEBASE                            5-35
  100.  
  101.                 iii
  102.  
  103. DAY                                5-36
  104. DAY$                                5-37
  105. DAYS                                5-38
  106. DELETE                                5-39
  107. DIM                                5-39
  108. DIRECTORY                            5-40
  109. DISKSPACE                            5-41
  110. EDIT                                5-42
  111. EJECT                                5-43
  112. END                                5-44
  113. END GROUP                            5-44
  114. END HEADING                            5-45
  115. END REPORT                            5-45
  116. ENTER                                5-46
  117. EOF                                5-48
  118. ERASE                                5-49
  119. ERR$                                5-50
  120. ERRNO                                5-50
  121. EXECUTE                                5-51
  122. EXP                                5-52
  123. EXPORT                                5-53
  124. FCASE$                                5-55
  125. FILE                                5-56
  126. FIX                                5-57
  127. FOOTING                                5-58
  128. FOR TO NEXT                            5-58
  129. FORM                                5-60
  130. FOUND                                5-60
  131. FREE                                5-61
  132. GET                                5-62
  133. GOSUB                                5-62
  134. GOTO                                5-63
  135. GROUP                                5-64
  136. HEADING                                5-65
  137. HOME                                5-65
  138. HRS                                5-66
  139. IF THEN ELSE                            5-66
  140. IMPORT                                5-69
  141. INDEX                                5-70
  142. INPUT                                5-71
  143. INSTR                                5-72
  144. INT                                5-74
  145.  
  146.                 iv
  147.  
  148. KEY                                5-75
  149. LABELS                                5-77
  150. LCASE$                                5-78
  151. LEFT$                                5-78
  152. LEN                                5-80
  153. LET                                5-80
  154. LIST                                5-82
  155. LOAD                                5-83
  156. LOCATE                                5-84
  157. LOG                                5-85
  158. LOOKUP                                5-85
  159. LTRIM$                                5-87
  160. MAKE                                5-88
  161. MENU                                5-89
  162. MENU CLEAR                            5-90
  163. MENU ON                                5-90
  164. MERGE                                5-92
  165. MID$                                5-92
  166. MINS                                5-94
  167. MOD                                5-94
  168. MODIFY                                5-95
  169. MONTH                                5-96
  170. MONTH$                                5-97
  171. NEW                                5-98
  172. NEWLINE                                5-98
  173. NOW                                5-99
  174. NUMBASE                                5-100
  175. ON ERROR                            5-100
  176. ON GOSUB                            5-102
  177. ON GOTO                                5-102
  178. OPEN                                5-103
  179. OPEN FORM                            5-104
  180. OPEN FIELDS                            5-104
  181. OPEN FILE                            5-105
  182. ORDER                                5-106
  183. OUTPUT TO                            5-109
  184. PASSWORD                            5-110
  185. PCOL                                5-110
  186. POSITION                            5-111
  187. PRINT                                5-112
  188. PROTECT                                5-114
  189. PROW                                5-114
  190.  
  191.                 v
  192.  
  193. QUIT                                5-115
  194. READ                                5-116
  195. RECCOUNT                            5-116
  196. REM                                5-117
  197. REMOVE FILE                            5-118
  198. REMOVE FROM                            5-118
  199. REMOVE INDEX                            5-119
  200. RENAME                                5-120
  201. REORGANIZE                            5-120
  202. REPLICATE                            5-121
  203. REPORT                                5-122
  204. REQUEST                                5-123
  205. RESTORE                                5-125
  206. RESUME                                5-126
  207. RETURN                                5-127
  208. RIGHT$                                5-127
  209. RND                                5-128
  210. ROW                                5-129
  211. RUN                                5-129
  212. SAVE                                5-130
  213. SAVE FILE                            5-130
  214. SAY                                5-131
  215. SCRDUMP                                5-132
  216. SECS                                5-132
  217. SELECT commands                            5-132
  218. SELECT CURRENT                            5-133
  219. SELECT DUPLICATE                        5-134
  220. SELECT FIRST                            5-134
  221. SELECT KEY                            5-135
  222. SELECT LAST                            5-136
  223. SELECT NEXT                            5-136
  224. SELECT PREVIOUS                            5-136
  225. SELECT REMOVE                            5-137
  226. SELECT WHERE                            5-137
  227. Query Language Commands                        5-138
  228. SELECT                                5-140
  229. SER                                5-142
  230. SET                                5-142
  231. SET BUFFERS                            5-144
  232. SET PAGING                            5-144
  233. SET view mode                            5-145
  234. SGN                                5-145
  235.  
  236.                 vi
  237.  
  238. SHOW                                5-145
  239. SIN                                5-147
  240. SPACE$                                5-147
  241. SQR                                5-148
  242. STORE                                5-148
  243. STR$                                5-150
  244. TAN                                5-151
  245. THOUSECS                            5-151
  246. TIME$                                5-152
  247. TIMEVAL                                5-152
  248. TODAY                                5-153
  249. TRIM$                                5-154
  250. UCASE$                                5-154
  251. UPDATE                                5-155
  252. VAL                                5-156
  253. VIEW                                5-157
  254. WAIT                                5-157
  255. WHERE                                5-158
  256. WHILE WEND                            5-160
  257. YEAR                                5-160
  258. CHAPTER 6
  259. QUICK REFERENCE GUIDE                        6-1
  260. INDEX                                I-1
  261.  
  262.                 vii
  263.  
  264.              CHAPTER 1 - INTRODUCTION TO DML
  265.  
  266. Welcome to Superbase Professional's Database Management Language (DML). DML
  267. is based on the programming language Basic. It includes most of the
  268. standard Basic commands and functions, but supplements them with a large
  269. number of commands and functions that are specific to database management.
  270.  
  271. The database commands duplicate the controls that Superbase Professional
  272. provides through its menus and dialogs. This means that almost all of
  273. Superbase's file and record handling facilities are available under program
  274. control. In fact, apart from Fast Forwards, Rewind and Duplicate, you can
  275. now carry out any Superbase operation using a single program command.
  276.  
  277. Once you have familiarized yourself with Superbase's controls, the
  278. corresponding program, you may find the idea of learning a program language
  279. daunting. But as far as DML is concerned, a little goes long way, and you
  280. do not need to be fully conversant with the language in order to take
  281. advantage of it.
  282.  
  283. In effect, you are already following a program sequence every time you
  284. perform a task which involves a series of menu operations. Writing a
  285. program that performs the task for you is simply a matter of entering
  286. commands in the same sequence. Generally, you will be able to find a single
  287. command to duplicate each of the menu operations.
  288.  
  289. As you acquire more expertise, you can move on, building bigger and more
  290. complex programs by combining routines, until you have fully automated your
  291. database system. When you're ready, you can incorporate Superbase forms
  292. into your programs, taking advantage of their built-in facilities for
  293. generating and retrieving records in several files at once.
  294.  
  295. At the highest level, you can specify your own pull-down menus, replacing
  296. the standard Superbase menus with the options that are relevant to the job
  297. in hand. And you can customize your application to an even more detailed
  298. level by creating your own pop-up selection panels to guide the user's
  299. choices.
  300.  
  301.                 1-1
  302.  
  303. USING THIS GUIDE
  304.  
  305. Before reading this guide, you will need to be familiar with Superbase's
  306. menu and keyboard controls. Many of DML's commands provide a program
  307. equivalent of a menu or keyboard option, and the descriptions given here
  308. presume that you already know how to use the corresponding option.
  309.  
  310. However, once you have mastered Superbase itself, you do not need to read
  311. this book all the way through. As a reference guide, it can be consulted as
  312. and when it is needed.
  313.  
  314. HOW TO USE THIS GUIDE
  315.  
  316. Chapter 2, Overview, describes the most basic features of DML. You can
  317. think of it as a grammar book for the language. It sorts DML's 'keywords'
  318. and other components into different groups and, more importantly, sets out
  319. all the rules for using them. For example, it specifies the maximum length
  320. for a program line,  and gives the rules for creating variable names.
  321.  
  322. Chapter 3 explains how to use the Program Editor. This covers entering and
  323. editing programs, storing them on disk and loading them from disk. It also
  324. explains how to execute programs, and how to create a 'start up' program
  325. which will be executed automatically when you start a session with
  326. Superbase.
  327.  
  328. Chapter 4 describes Superbase's function key facility. It explains how to
  329. define the function keys and discusses various applications for them.
  330.  
  331. Chapter 5, Keyword Reference Guide, forms the bulk of the manual. In this
  332. chapter, you will find an entry for each DML keyword, which gives the
  333. keyword's syntax and describes its usage. The entries are in alphabetical
  334. order starting with the ? command. At the front of Chapter 5, there is an
  335. explanation of the conventions used to show a keyword's syntax.
  336.  
  337. Chapter 6 is a Quick Reference Guide. It gives the syntax for each DML
  338. keyword together with a brief description of its function.
  339.  
  340.                 1-2
  341.  
  342.             CHAPTER 2 - OVERVIEW
  343.  
  344. OPERATING MODES
  345.  
  346. DML has two modes of operation: direct mode and program mode.
  347.  
  348. DIRECT MODE
  349.  
  350. In this mode, DML executes instructions as soon as you have typed them in.
  351. First you need to select the Command option from the Program Menu. Then
  352. enter your instructions - a single command or a line of commands separated
  353. by colons - in the command line window; when you select 'OK' or press the
  354. Return key, DML will carry out the instructions straight away. The command
  355. line window is 64 characters long but you can enter up to 255 characters
  356. and move within the window using the cursor keys.
  357.  
  358. PROGRAM MODE
  359.  
  360. In program mode, DML does not execute commands as you enter them. Instead
  361. they are stored in memory and executed only when the program is run. The
  362. main difference between this mode and direct mode is that with the latter
  363. you can only enter and execute one line at time; program mode allows you to
  364. enter a series of instruction lines which are carried out in sequence.
  365. Program lines can be up to 255 characters long.
  366.  
  367. OTHER DML APPLICATIONS
  368.  
  369. DML's functions, along with its operators and variables, can also be used
  370. in other Superbase operations - such as field definition validations and
  371. calculations, filter conditions, update commands and query derived field
  372. definitions.
  373.  
  374. KEYWORDS AND RESERVED WORDS
  375.  
  376. Any word that DML recognizes as a specific instruction, or part of an
  377. instruction, is known as a keyword.
  378.  
  379. A keyword cannot be used as a variable name, a field name, or a label. In
  380. this context, keywords are also knows as reserved words - DML reserves them
  381. for its own use, and will interpret then as such even if they are in lower
  382. case.
  383.  
  384.                 2-1
  385.  
  386. A reserved word can, however, from part of a name. For example, you can
  387. incorporate the reserved word TO in any of the following ways:
  388.  
  389. TOP:        (in a label)
  390. TOTAL%        (a numeric variable)
  391. tot$        (in a string variable)
  392. TOTALS$        (in a field name)
  393.  
  394. But you cannot use it like this:
  395.  
  396. TO:
  397. TO%
  398. TO$
  399.  
  400. COMMANDS AND STATEMENTS
  401.  
  402. Some programming manuals make a strict division between two kinds of
  403. executable instructions - commands and statements. Commands are those
  404. instructions which are generally executed in direct mode, while statements
  405. are instructions that can only appear in a program line.
  406.  
  407. In DML there are only a few instructions that cannot be used in both
  408. operating modes and so the two terms are used almost interchangeably. Thus
  409. we refer to a line with more than one instruction on it as a
  410. multi-statement line; but it could equally well be called a multi-command
  411. line.
  412.  
  413. VARIABLES
  414.  
  415. There are three types of variables in DML: string variables, numeric
  416. variables,  and arrays. In many circumstances, the fields in a Superbase
  417. file can also be treated in the same way as variables.
  418.  
  419. VARIABLE NAMES
  420.  
  421. Numeric variables must end with the '%' character, string variables end
  422. with an '$' character. Apart from this, the names for both types of
  423. variable follow the same rules:
  424.  
  425. Variable names have a maximum length of 14 characters and a minimum length
  426. of 1 character (excluding '%' or '$').
  427.  
  428. The first character of the name must be a letter in the range 'a' to 'z'
  429. but the remaining characters can be either alphabetic or numeric.
  430.  
  431.                 2-2
  432.  
  433. DML is not case sensitive; 'abc%' is the same as 'ABC%', and 'abc$' is the
  434. same as 'ABC$'.
  435.  
  436. A variable name can contain a reserved word, but cannot consist of just a
  437. reserved word and the variable suffix, % or $. For example, names like
  438. 'lef$',  'cos%', 'report$' and 'FILE%' are forbidden. See Appendix A for
  439. the list of reserved words.
  440.  
  441. Before using a variable, you must define it by assigning a value to it.
  442. This means that the first occurrence of a variable should be in an
  443. assignment statement, with the variable to the left of the equal sign.
  444. Suppose, for example,  you instructed DML to display the value of a$, using
  445. the command
  446.  
  447.     ? a$
  448.  
  449. If you have not assign a value to a$ beforehand, DML will issue the error
  450. message:
  451.  
  452.     Can't do this
  453.     Variable not defined
  454.  
  455. To avoid this error message, you would have to define a$ at an earlier
  456. stage in the program, with line such as
  457.  
  458.     a$="Hello"
  459.  
  460. or
  461.  
  462.     a$=""
  463.  
  464. The double quotes are known as the 'empty string'. They allow you to define
  465. a string variable without actually assigning a specific value; they are
  466. also used to clear the contents of string variables.
  467.  
  468. There are, however, a number of exceptions to the rule about defining
  469. variables. Some statements - READ, ASK, WAIT, and INPUT - define variables
  470. implicitly when they are used for the first time. Thus DML would accept the
  471. line:
  472.  
  473.     READ a$
  474.  
  475. even if you had not assigned a value to a$ previously.
  476.  
  477. NUMERIC VARIABLES
  478.  
  479. DML's numeric variables hold numbers at 13 figure accuracy, but if
  480. displayed or printed, they are shown in the current default numeric format.
  481. Note that there is only one type of numeric variable. In some versions of
  482. Basic, the % suffix indicates that the variable can only store whole
  483. numbers (integers): in DML, the
  484.  
  485.                 2-3
  486.  
  487. same numeric variable can be used for both whole numbers and floating point
  488. numbers.
  489.  
  490. STRING VARIABLES
  491.  
  492. String variables are used to hold ASCII characters - usually alphanumeric
  493. text. The maximum length of data that can be held in a string variable is
  494. 255 characters.
  495.  
  496. ARRAYS
  497.  
  498. DML supports string and numeric arrays with up to three dimensions. The
  499. maximum number of elements in an array is limited only by the amount of
  500. memory available.
  501.  
  502. The rules for array names are the same as those for numeric and string
  503. variables. Numeric arrays must end with '%' character, string arrays must
  504. end with '$' character.
  505.  
  506. SYSTEM VARIABLES
  507.  
  508. TODAY, NOW and ERRNO are variables which are supplied by DML. TODAY gives
  509. the system date, NOW gives the system time. DML treats these in the same
  510. way as date and time fields; that is, although they are numeric variables,
  511. they are displayed in the current date or time format. If the time of day
  512. is 9:41 and the system clock has been set to this time. NOW would display
  513. it as 9:41. But it stores this as 34919810 - the number of thousandths of a
  514. second from midnight to 9:41. ERRNO returns the number of the last error
  515. that occurred.
  516.  
  517. You cannot assign a value to a system variable, but otherwise TODAY, NOW
  518. and ERRNO can used in the same way as any other numeric variable.
  519.  
  520. FILE TYPES
  521.  
  522. When you save a file using one of the SAVE options, DML automatically adds
  523. one of the following extension names to the file name:
  524.  
  525.     aaa.sbf is a database file
  526.     aaa.sbd is a file definition for a database file
  527.     aaa.sbk is a function key file
  528.     aaa.sbp is a program file
  529.     aaa.sbq is a Query file
  530.     aaa.sbt is a text file saved from the text editor
  531.  
  532.                 2-4
  533.  
  534.     aaa.sub is an Update file
  535.     aaa.### is an index (where ### is a number from 001 to 999)
  536.  
  537. DML stores program files, Text Editor files, database files and index files
  538. in its own format (for example, it tokenizes keywords in program files and
  539. stores formatting information with documents saved in the Text Editor). The
  540. others are all text files and only contain ASCII characters.
  541.  
  542. FIELDS
  543.  
  544. With a few exceptions, you can use fields in the same way as variables. For
  545. instance, you can input data directly to fields; you can supply a field
  546. name as the argument for a function; and you can assign values to fields.
  547.  
  548. Fieldnames must conform to the rules for field names as set out in Volume
  549. 1, i.e.:
  550.  
  551.     The maximum length is 15 characters.
  552.     The minimum length is one character.
  553.  
  554. They must begin with an alphabetic character, but can thereafter contain
  555. any alphanumeric characters. They can also contain the underscore and space
  556. characters. Superbase will accept a field name with several spaces embedded
  557. in it - i.e., 'a bc d' is a valid name - but this is not recommended.
  558.  
  559. DML is not case sensitive; 'abc' is the same as 'ABC'.
  560.  
  561. The file a field belongs to must be open; otherwise the following requester
  562. appears:
  563.  
  564.     Can't do this....
  565.     'field name'
  566.     Can't find this field
  567.  
  568. Where more than one file is open and there are two files with the same
  569. field name, the file name must be given as an extension to the field name
  570. and the two must be separated by a full stop. This enables DML to identify
  571. the field you are referring to.
  572.  
  573. NOTE: FAILING TO SUPPLY FILE EXTENSION NAMES TO FIELDS MAY RESULT IN
  574. INCORRECT DATA, ALTHOUGH IT DOES NOT CAUSE AN ERROR.
  575.  
  576.                 2-5
  577.  
  578. If the file name contains spaces, it must be included within quotation
  579. marks,  e.g.:
  580.  
  581.     fielda.filea
  582.     name.Customers
  583.     Lastname."Customer File"
  584.  
  585. DATE AND TIME
  586.  
  587. Superbase stores dates as julian date numbers; that is, as the number of
  588. days from 31st December in the year zero. This means that date fields are
  589. numeric fields and hold their dates as numbers. When you display a date
  590. field, however,  Superbase automatically converts it to a more recognizable
  591. format: it takes the format which has been set in the file definition (see
  592. Chapter 2, Volume 1).
  593.  
  594. The date format only controls the way dates are displayed. You can enter a
  595. date from the keyboard in almost any format. For instance, the date might
  596. be shown on screen as 24/02/87, but you can type in a date like '28
  597. February, 1962' and DML will accept it.
  598.  
  599. Incidentally, DML does remember that eleven days were lost when the
  600. Gregorian Calendar reform was implemented (September 2nd, 1752 is followed
  601. by September 14th).
  602.  
  603. As with dates, DML stores the time in time fields as a numeric value, but
  604. displays it in a different format. The time is stored as the number of
  605. thousandths of a second from midnight. When you display the time, it is
  606. given in hours and minutes in either 12 or 24 hour format.
  607.  
  608. FUNCTIONS
  609.  
  610. Functions form one of the largest groups of DML keywords. Most of them
  611. perform a calculation on a number or a string, but there are also functions
  612. that give information about some aspect of the system. RECCOUNT, for
  613. example returns the number of records in a file, and FREE returns the
  614. amount of free memory space. Unlike a command, a function cannot be entered
  615. on its own as a statement. Thus:
  616.  
  617.     ? RECCOUNT ("address")
  618.  
  619.                 2-6
  620.  
  621.     NUMRECS%=RECCOUNT ("address")
  622.  
  623. are valid statements, but
  624.  
  625.     RECCOUNT ("address")
  626.  
  627. produces an error message.
  628.  
  629. All functions take an argument, which is enclosed in parentheses, and
  630. return a result. If the function calculates a result, the argument is what
  631. it works on. In the example above, "address" is the argument. It tells the
  632. function which file to count.
  633.  
  634. Depending on the function, the argument (or arguments) may be a field name,
  635. a file name, constant, a variable, or a combination of these connected by
  636. an operator to form an expression. You will find details of what kind of
  637. argument a function expects, in the Keyboard Reference section.
  638.  
  639. Although functions are usually classed as either string or numeric
  640. functions,  this does not always guarantee that they take a particular kind
  641. of argument. Numeric functions always take numeric arguments, but some
  642. string functions also expect a numeric argument. CHR$, for example, returns
  643. a string result from a numeric argument.
  644.  
  645. When it comes to finding out what type of result a function returns, there
  646. is a simple rule you can apply. Functions which have a $ character at the
  647. end, return their results as string data; if they do not end in a $, they
  648. return a numeric result. There is one exception to this rule - REPLICATE,
  649. which returns a string result, despite the fact that it does not have a $
  650. at the end.
  651.  
  652. OPERATORS
  653.  
  654. DML provides three types of operators: arithmetic, relational and string.
  655.  
  656. ARITHMETIC OPERATORS
  657.  
  658. Addition
  659.  
  660. The plus sign specifies that the operand on the right is added to the
  661. operand on the left, e.g.:
  662.  
  663.     2 + 2
  664.     a% + b% + c%
  665.     a% + 12.225
  666.  
  667.                 2-7
  668.  
  669. Subtraction
  670.  
  671. The minus sign specifies that the operand on the right will be subtracted
  672. from the operand on the left e.g.:
  673.  
  674.     -3
  675.     -a%
  676.  
  677. Multiplication
  678.  
  679. The asterisk is recognised by DML as the multiplication symbol and
  680. specifies that the operand on the left is multiplied by the operand on the
  681. right, e.g.:
  682.  
  683.     3 * 2
  684.     a% * b%
  685.     a% * 12.225
  686.  
  687. Division
  688.  
  689. The slash is recognized by DML as the division symbol and specifies that
  690. the operand on the left is divided by the operand on the right, e.g.:
  691.  
  692.     3 / 2
  693.     a% / b%
  694.     a% / 12.225
  695.  
  696. NOTE: UNLIKE IN MANY OTHER PROGRAMMING LANGUAGES, DIVISION BY ZERO DOES NOT
  697. CAUSE AN ERROR MESSAGE AND RETURNS A VALUE OF ZERO. THIS, OF COURSE, IS A
  698. FALSE RESULT,  AND YOU SHOULD CHECK NUMERICAL DATA TO ENSURE IT DOES NOT
  699. OCCUR.
  700.  
  701. Exponentiation
  702.  
  703. The up arrow (or caret) is recognized by DML as the exponentiation symbol
  704. and specifies that the operand on the left is raised to the power specified
  705. by the operand on the right (the exponent); that is, the operand on the
  706. left is multiplied by itself the number of times specified by the exponent.
  707. If the exponent is 2, the number is squared; if the exponent is 3, the
  708. number is cubed; if the exponent is 1/2, the square root of the number
  709. results, e.g.:
  710.  
  711.                 2-8
  712.  
  713.     3 ^ 2            (3 squared)
  714.     a% ^ b%        
  715.     a% ^ 12.225
  716.     a6 ^ 0.5        (the square root of 16)
  717.     27 ^ 0.33333333        (the cuberoot of 27)
  718.     3 ^ -2            (1/3 * 1/3)
  719.  
  720. Modulo arithmetic
  721.  
  722. MOD gives the remainder when the operand on the left is divided by the
  723. operand to the right, e.g.:
  724.  
  725.     17 MOD 7        (returns 3)
  726.     a % MOD b%
  727.  
  728. Parentheses
  729.  
  730. Parentheses are used to change the order in which the different parts of an
  731. expression are calculated. Without parentheses, expressions are evaluated
  732. in a certain order which depends on the operators they contain - some
  733. operators have precedence over others (see the Table of Precedence). For
  734. example, multiplication has precedence over addition; so, in the
  735. expression:
  736.  
  737.     3 + 4 * 2
  738.  
  739. the 'four times' part is worked out first and then added to 3, giving 11 as
  740. the result. You could alter this by enclosing '3 + 4' in parentheses:
  741.  
  742.     (3 + 4) * 2
  743.  
  744. to give a result of 14.
  745.  
  746. Parentheses must always be paired - each '('should have a matching')'.
  747.  
  748. Concatenation
  749.  
  750. When used with strings or string variables, the plus sign causes the string
  751. specified by the right operand to be appended to the string specified by
  752. the left operand, e.g.:
  753.  
  754.     "ABCD" + "defg"            evaluates as "ABCDefgh"
  755.  
  756. Used in this way, the plus sign acts as a string operator.
  757.  
  758.                 2-9
  759.  
  760. RELATIONAL OPERATORS
  761.  
  762. Relational operators compare the values of two numbers or two strings, and
  763. return a result which is either true or false. They are mainly used with IF
  764. THEN and WHILE WEND statements to make a decision about whether the program
  765. takes a particular action or not. For example:
  766.  
  767.     IF n% > 30 THEN GOSUB label
  768.  
  769. The relational operators are:
  770.  
  771.     >        greater than           12>55 is false, i.e.0
  772.     =        greater than or equal to    
  773.     <        less than
  774.     <=        less than or equal to       27<=27 is true, i.e.-1
  775.     <>        not equal to           1=5-4 is true, i.e.-1
  776.     =        equal to
  777.     LIKE        pattern matching operator for strings.
  778.     CONTAINS    pattern matching operator for text files.
  779.  
  780. As far as the user is concerned the result of comparison is either true or
  781. false. But when DML comes to evaluate a comparison, it actually assigns a
  782. numeric value to the result. If the result is true, DML assigns it the
  783. value of -1; if false, it assigns the value of 0. This means that if you
  784. enter the statement:
  785.  
  786.     ? 8>5
  787.  
  788. or
  789.  
  790.     ? "F"=LEFT$ ("FRIDAY", 1)
  791.  
  792. DML will display -1. If the result of a comparison is false, it will
  793. display 0. For string operands, comparison is character by character from
  794. the left where 'a' is less than 'b' is less than 'c' and uppercase
  795. characters are less than lower case characters ('A" is less than 'a'). Note
  796. that numeric data can only be compared with numeric data and string data
  797. can only be compared with string data. If you attempt to compare numeric
  798. data with string data then the message:
  799.  
  800.     Can't do this/Data types don't match
  801.  
  802. appears.
  803.  
  804.                 2-10
  805.  
  806. LIKE
  807.  
  808. LIKE is a case insensitive pattern matching relational operator which is
  809. used to compare string data. The question mark '?' and asterisk '*'
  810. characters can be used as wildcards. The question mark matches single
  811. characters and the asterisk '*' matches multiple characters.
  812.  
  813. For a full explanation of how to use LIKE, see Volume I, Appendix B.
  814.  
  815. CONTAINS
  816.  
  817. CONTAINS works in the same way as LIKE, but it used with ASCII files on
  818. disk; for example, you could use the expression:
  819.  
  820.     CONTAINS "*Smith*"
  821.  
  822. to search for an ASCII file which contained the name Smith. See Chapter 9, 
  823. Volume 1, for more details.
  824.  
  825. LOGICAL OR BOOLEAN OPERATORS.
  826.  
  827. Logical operators are most frequently used to modify the results of
  828. relational operators. An expression that contains a relational operator can
  829. either be true or false. With a logical operator you can create more
  830. complex expressions whose truth or falsity (their 'truth value') depends on
  831. the truth or falsity of one or more relational expressions.
  832.  
  833. AND
  834.  
  835. This operator allows you to test whether two comparisons are true at the
  836. same time. For example:
  837.  
  838.     12 > 5
  839.  
  840. and
  841.  
  842.     6 < 16
  843.  
  844. are both true, so
  845.  
  846.     12 > 5 AND 6 < 16
  847.  
  848. is also true.
  849.  
  850.                 2-11
  851.  
  852. NOT
  853.  
  854. NOT reverses the truth or falsity of an expression. Thus:
  855.  
  856.     12 < 5
  857.  
  858. is false, so
  859.  
  860.     NOT 12 < 5
  861.  
  862. is true.
  863.  
  864. NOT is often used with the EOF function to set up a program loop for
  865. processing all the records in a file, e.g.:
  866.  
  867.     WHILE NOT EOF ("address")
  868.     SELECT NEXT
  869.     VIEW
  870.     WEND
  871.  
  872. OR
  873.  
  874. OR gives a true result if one or the other, or both, of its operands is
  875. true. For example:
  876.  
  877.     12>5 OR 12<5
  878.     8=2*3 OR 6>5
  879.     8=2*4 OR 6<5
  880.  
  881. all give true results.
  882.  
  883.     12>5 OR A$="LONDON"
  884.  
  885. gives a true result whatever the value of A$.
  886.  
  887.     8=2*3 OR 12<5
  888.  
  889. gives a false result.
  890.  
  891. Logical operators can also be used with numeric expressions to give a
  892. result which depends on the binary digits of the operands. In this context,
  893. they are sometimes known as bitwise operators. Instead of comparing the
  894. truth or falsity of expressions, AND and OR - when used as bitwise
  895. operators - compare the binary digits of two numbers, while NOT takes a
  896. single number, and changes each binary 1 to 0, and vice versa. Thus AND
  897. returns binary 1, if and only if, the corresponding digits in the two
  898. operands are both 1, e.g.:
  899.  
  900.     85 AND 19
  901.  
  902. gives a value of 17.
  903.  
  904.                 2-12
  905.  
  906.     85 in binary is 01010101
  907.     19 in binary is 00010011
  908.  
  909. The result is 00010001 which is 17
  910.  
  911. TABLE OF PRECEDENCE
  912.  
  913. Complex expressions, containing more than one operator and several simple
  914. expressions, are evaluated according to the following table. The higher up
  915. the table an operator is, the higher the precedence it is given. This means
  916. that if there are two simple expressions, the one whose operator has the
  917. highest precedence will be evaluated first.
  918.  
  919.     ^        Exponentiation
  920.     */        Multiplication and Division
  921.     MOD        Modulo arithmetic
  922.     +-        Addition and Subtraction
  923.     <> <=> =    Relational operators
  924.     LIKE CONTAINS    Relational operators
  925.     NOT        Logical NOT
  926.     AND        Logical AND
  927.     OR        Logical OR
  928.  
  929. Where identical weighted operators are concerned evaluation will be from
  930. left to right e.g.:
  931.  
  932. 12 + 3-2    is evaluated as    12 + 3=15 : 15-2=13
  933. 12 + 3*4    is evaluated as    3 * 4=12 : 12 + 12=24
  934. 12 + 3*4-2    is evaluated as    3*4=12 : 12 + 12=12 : 24-2=22
  935.  
  936. Parentheses can be used to promote expressions up the table, e.g.:
  937.  
  938. (12+3) * (4-2)  evaluates as   15*2=30
  939.  
  940. CONSTANTS
  941.  
  942. The fixed values that you assign to variables or use as part of an
  943. expression are known as constants. There are two types: string constants
  944. and numeric constants. String constants must be enclosed in quotation
  945. marks. DML also provides a ready-defined constant PI, which has the value
  946. of 3.141593265359 and can be used in numeric calculations.
  947.  
  948.                 2-13
  949.  
  950. EXPRESSIONS
  951.  
  952. Expressions are formed from any combination of:
  953.  
  954. Fields
  955. Variables
  956. Constants
  957. Functions
  958. Operators
  959.  
  960. An expression can consist of a single variable name, a field name, or a
  961. constant,  or it may be more complex, combining these with operators,
  962. constants and functions. The following are examples of expressions:
  963.  
  964. 396
  965. TODAY
  966. a$
  967. "31 Ambleside Drive"
  968. textfielda
  969. numfielda
  970. Firstname.address
  971. LEFT$ (Firstname.address, 1)
  972. 3.44*22.8 + 450
  973. "Mr" + A$
  974. A$ + B$
  975. a%<>b%
  976. (a$=b$) AND (c%=1)
  977. INT (RND (1) *26) +1
  978. COS (n%)
  979.  
  980. LINE FORMAT AND LABELS
  981.  
  982. There are no line numbers in DML; instead, to provide a reference for GOTO
  983. and GOSUB commands (or ON GOTO and ON GOSUB commands) you can place a label
  984. at the front of a line. Labels can be any combination of alphanumeric
  985. characters but cannot contain spaces.
  986.  
  987. Labels must end in a colon (':') unless they consist only of numeric
  988. characters. You can use a number as a label without adding a colon, but
  989. this will not have the effect of altering the sequence of program lines.
  990. So, if you enter a line with the label '30' after a line with the label
  991. '50', both lines will remain in that order.
  992.  
  993. A DML line, whether in direct mode or program mode, can contain more than
  994. one statement, provided the statements are separated by colons.
  995.  
  996.                 2-14
  997.  
  998. Labels, however, can only be used in program mode.
  999.  
  1000. Any command which is placed at the beginning of a multi-statement line
  1001. should be followed by a space. If it is followed by a colon without an
  1002. intervening space, DML may interpret it as a label. For example, in the
  1003. line:
  1004.  
  1005.     CLS: STATUS
  1006.  
  1007. the command CLS has no effect, but
  1008.  
  1009.     CLS: STATUS
  1010.  
  1011. works as intended.
  1012.  
  1013. You also need to insert a space before an expression - a variable name or a
  1014. field name, for example - if it is preceded by a DML command word. But
  1015. otherwise in program mode, DML will accept lines without any spaces in them
  1016. (it inserts spaces when it parses a line).
  1017.  
  1018. In direct mode, it is generally necessary to insert spaces between the
  1019. various elements of a command line.
  1020.  
  1021. SYNTAX
  1022.  
  1023. The Keyword Reference section gives the exact syntax for each keyword.
  1024. However,  there are several rules that apply generally.
  1025.  
  1026. FILE NAMES AND FIELD NAMES
  1027.  
  1028. Wherever a command is followed by a file name - or takes a file name as one
  1029. of its arguments - the file name must be enclosed in quotation marks.
  1030. Fieldnames should not be in quotation marks.
  1031.  
  1032. For most operations, you should not include the extension name for a file
  1033. (the part of the name after the full stop). Superbase automatically looks
  1034. for files with the appropriate extension; so, with the command:
  1035.  
  1036.     OPEN FILE "Address"
  1037.  
  1038. it looks for the file "Address.sbf".
  1039.  
  1040. The one exception to this rule is when you are dealing with text files.
  1041. OPEN FOR INPUT/OUTPUT, OUTPUT TO, IMPORT and EXPORT all take data to or
  1042. from text files, and require that file names are given in full.
  1043.  
  1044. If you save a file from Superbase's text editor, it automatically adds an
  1045. '.sbf' extension to the file name - and when you open a file from the text
  1046. editor, you do not need to supply the '.sbt' extension. But when you make
  1047. use of a text
  1048.  
  1049.                 2-15
  1050.  
  1051. editor file in some other applications - with IMPORT, for example - you
  1052. must remember to include the .sbt extension. By the same token, you will
  1053. not be able to load text files into the text editor unless you give them a
  1054. .sbt extension.
  1055.  
  1056. UPPER CASE AND LOWER CASE
  1057.  
  1058. Certain string functions such as INSTR are case sensitive, but otherwise
  1059. DML ignores the difference between lower and upper case letters (small
  1060. letters and capital letters). In other words, it does not matter whether
  1061. you use lower or upper case letters when you type in a keyword or any of
  1062. the following:
  1063.  
  1064.     variables
  1065.     file names
  1066.     field names
  1067.  
  1068. It is a good idea, though, to enter program lines and direct command lines
  1069. in lower case. Once DML has accepted a line, it converts any reserved words
  1070. (that is, any keywords) to upper case. Typing in lower case allows you to
  1071. check that you have not used a reserved word by mistake.
  1072.  
  1073.                 2-16
  1074.  
  1075.             CHAPTER 3 - THE PROGRAM EDITOR
  1076.  
  1077. THE PROGRAM MENU
  1078.  
  1079. Operations relating to programs and programming are controlled from a
  1080. single menu at the right of the menu bar, the Program menu. This section
  1081. lists the Program menu options, and gives a brief explanation of their
  1082. functions. Apart from Print and Remove (which should not require further
  1083. explanation), each option is also described in more detail in the sections
  1084. that follow.
  1085.  
  1086. COMMAND    Opens the Command line window, allowing the user to enter program
  1087.     instructions as direct commands.
  1088.  
  1089. RUN    Runs the program in memory or, if there is no program in memory,
  1090.      loads a program from disk and runs it.
  1091.  
  1092. NEW    Opens the Program Editor window and clears any program that may be
  1093.     in memory.
  1094.  
  1095. EDIT    Opens the Program Editor window.
  1096.  
  1097. OPEN    Loads a program from disk into memory.
  1098.  
  1099. CLOSE    Clears the program in memory - the program that is currently in the
  1100.     Program Editor - and closes the Program Editor window.
  1101.  
  1102. SAVE    Saves the program in memory to disk.
  1103.  
  1104. PRINT    Prints the program in memory.
  1105.  
  1106. REMOVE    Deletes a program file from disk.
  1107.  
  1108. THE PROGRAM EDITOR WINDOW
  1109.  
  1110. When you select Edit or New from the Program menu, Superbase opens a window
  1111. at the right-hand half of the screen. This is the program window where you
  1112. enter and edit programs (see next page).
  1113.  
  1114. In most respects, the program window can be treated in the same way as the
  1115. text window: you use the same controls for closing, resizing and moving the
  1116. window (as explained in Chapter 10, Volume 1); and you also use many of the
  1117. same key
  1118.  
  1119.                 3-1
  1120.  
  1121. controls for editing a program. In fact, both the Program Editor and the
  1122. Text Editor make use of the same window. The window can only be occupied by
  1123. one of them at a time, but any changes you make to the size or location of
  1124. the window will apply when you switch to the other editor.
  1125.  
  1126. The main difference between the two is that the Program Editor does not
  1127. have its own set of menus. The Program menu is available at all times -
  1128. except when the Text Editor menus are active - whether the program window
  1129. is open or closed.
  1130.  
  1131. As with the Text Editor, you can switch between the program window and the
  1132. database window simply by moving the mouse pointer to the required window
  1133. and clicking in it. Thus, to edit a record after opening the program
  1134. window, you would click twice in one of the fields displayed in the
  1135. database window - once to make the database window active, and once to
  1136. activate the record editing cursor (on the Amiga, you would only need to
  1137. click once). If you then wanted to return to the Program Editor, clicking
  1138. once in the program window would make the program cursor active again.
  1139.  
  1140. Notice that the Close option on the Program menu not only closes the window
  1141. but also removes the current program from memory. If you wish to close the
  1142. window without clearing the program from memory, click on the close window
  1143. gadget at the top left-hand corner.
  1144.  
  1145.                 3-2
  1146.  
  1147. NOTE: Screen output from a Superbase program is displayed in the database
  1148. window. If there is a record in view, program data will be output below or
  1149. to the right of the bottom line of record data. To clear the database
  1150. window before displaying program data on screen, use the CLS command.
  1151.  
  1152. CREATING A NEW PROGRAM
  1153.  
  1154. Selecting Edit from the Program menu opens the program window and places
  1155. the program cursor at the top left-hand corner. When you enter the Program
  1156. Editor for the first time in a session, the window will be empty; you can
  1157. then start entering program lines straight away. If you have previously
  1158. loaded a program into memory and want to start afresh on a new program,
  1159. select New to clear the existing program from memory.
  1160.  
  1161. Entering program lines is simply a matter of typing them in at the
  1162. keyboard. When you have typed in a line, pressing the Return key will take
  1163. you to the start of the next line.
  1164.  
  1165. Superbase accepts program lines up to 255 characters long. As you type
  1166. characters beyond the right-hand edge of the window, the program will be
  1167. scrolled to the left. Using the scroll bars enables you to move the window
  1168. over any part of a line up to 255 characters.
  1169.  
  1170. LINE FORMAT
  1171.  
  1172. An explanation of the correct format for a Superbase program line is given
  1173. in Chapter 2, Line Format and Labels. However, it is worth repeating th
  1174. rule about inserting spaces in a line: you need to insert a space if you
  1175. enter an expression - such as a variable name, a field name, or a constant
  1176. - after a keyword, or if you enter two adjacent keywords. In the following
  1177. example, the space between the two items on the line must be entered by the
  1178. user:
  1179.  
  1180.     ? "Hello"
  1181.  
  1182. You should also type a space between a command and a colon if the command
  1183. is placed at the start of a multi-statement line. If you do not do this,
  1184. DML will interpret the command as a label.
  1185.  
  1186. Otherwise, you can ignore spaces as you type in a program. If a line
  1187. contains adjacent variables or operators and other elements of an
  1188. expression, DML inserts spaces between them when it 'parses' the line.
  1189.  
  1190. Parsing refers to the process which takes place when you press Return or
  1191. move the cursor away from the current line. DML scans the line and
  1192. identifies the various elements in it. As well as inserting spaces between
  1193. recognizable
  1194.  
  1195.                 3-3
  1196.  
  1197. elements, it also converts any keywords that are entered in lower case to
  1198. upper case. Thus if you typed:
  1199.  
  1200.     if a%=3.5+6then goto label1
  1201.  
  1202. DML would parse this line as:
  1203.  
  1204.     IF a%=3.5+6THEN GOTO label1
  1205.  
  1206. You are recommended to enter program lines in lower case as a way of
  1207. ensuring that you do not use reserved words as labels or variables. When a
  1208. line is parsed, you will be able to see at a glance whether these items are
  1209. correct,  because the reserved words will be shown in upper case.
  1210.  
  1211. It is unlikely that you will need to create programs with lines over 200
  1212. characters long. However, if you do, it is important to bear in mind that
  1213. spaces may be inserted in the line. Even though the line you type in is
  1214. less than 255 characters, it may exceed this limit when it has been parsed.
  1215.  
  1216. EDITING A PROGRAM
  1217.  
  1218. The Program Editor uses the same key controls for editing a program and
  1219. moving the cursor around the screen as the Text Editor. As you would
  1220. expect, it is not possible to specify margins or reformat a program; and the
  1221. style setting functions are not available. Otherwise, the only difference
  1222. is in the way the Return key works. In the Text Editor, Return either moves
  1223. the cursor to the start of the next line or creates a new line, depending
  1224. on whether overwrite or inset mode has been selected.
  1225.  
  1226. In this section, we only provide a list of the Program Editor key controls
  1227. together a brief description of their functions. For a detailed explanation
  1228. of these keys, see Chapter 10, Volume 1. The '^' character is used here to
  1229. represent the CTRL key (Control on the Atari ST); ^N for instance,
  1230. indicates that the CTRL key and the letter N should pressed in combination.
  1231.  
  1232. MOVING THE CURSOR
  1233.  
  1234. As with the Text Editor, you can move the cursor around the screen and edit
  1235. a program at any point on the screen.
  1236.  
  1237. The cursor keys are used to move the cursor by one character at a time.
  1238. Note that the term character includes the space character.
  1239.  
  1240.                 3-4
  1241.  
  1242. LEFT ARROW        Moves the cursor to next character to the left.
  1243.  
  1244. RIGHT ARROW        Moves the cursor to the next character to the
  1245.             right.
  1246.  
  1247. UP ARROW        Moves the cursor to the character in the same
  1248.             column on the line above.
  1249.  
  1250. DOWN ARROW        Moves the cursor to the character in the same
  1251.             column on the line below.
  1252.  
  1253. For larger cursor movements, use the following keys:
  1254.  
  1255. ^B            Takes the cursor to the first line in the text.
  1256. ^G            Takes the cursor to the last line in the text.
  1257. Home (GEM)        Moves the cursor to the beginning of a line.
  1258. Clr Home (GEM Atari)    Moves the cursor to the beginning of a line.
  1259. Shift right cursor (Amiga)  Moves the cursor to the beginning of a line.
  1260. End (GEM)        Moves the cursor to the end of line.
  1261. Insert (GEM Atari)    Moves the cursor to the end of line.
  1262. Shift left cursor (Amiga)  Moves the cursor to the end of a line.
  1263. Tab            Moves the cursor eight characters to the right.
  1264. Shift Tab        Moves the cursor eight characters to the left.
  1265. Control T        Moves the cursor eight characters to the left.
  1266.  
  1267. DELETING AND INSERTING
  1268.  
  1269. The following keys are used for deleting and inserting program lines or
  1270. parts of a program line:
  1271.  
  1272. BACKSPACE        Delete character to the left of the cursor.
  1273. DEL            Delete character to the right of the cursor.
  1274. ^W            Delete word.
  1275. ^E            Delete to end of line.
  1276. ^D            Delete line.
  1277. ^X            Clear line.
  1278. ^N            New line.
  1279. ^S            Split line.
  1280. ^A            Join line.
  1281. ^V            Insert mode on/off.
  1282. ^U            Undo.
  1283.  
  1284. Note that Undo works in the same way as in the Text Editor, and can be used
  1285. as a 'cut and paste' facility, allowing you to move multiple program lines
  1286. to a new position.
  1287.  
  1288.                 3-5
  1289.  
  1290. USING THE COMMAND LINE
  1291.  
  1292. Selecting the Command option on the Program menu presents you with the DML
  1293. Command Line dialog. Any commands you type in the command line box will be
  1294. executed as soon as you click on OK or press Return; that is, they will be
  1295. executed as direct commands.
  1296.  
  1297. The command line box accepts single or multi-statement lines (with
  1298. statements separated by colons) up to 255 characters. You can type in
  1299. commands when ever the cursor is present. If the cursor is not shown, click
  1300. in the box to activate it.
  1301.  
  1302. There is very little restriction on which keywords can be entered as direct
  1303. commands. READ (and DATA), GOSUB, and ON GOSUB cannot operate as direct
  1304. commands,  and you cannot use labels in the command line. Apart from these,
  1305. almost any single or multi-statement line that can be entered in a program
  1306. can also be entered in the command line.
  1307.  
  1308. Clearly, any statement that refers to another statement in the command line
  1309. will not operate, because of the absence of labels. However, it is possible
  1310. to enter GOTO statements which refer to labels in the current program. You
  1311. may want to do this when you are testing a program. The normal way of
  1312. executing a program - using the RUN command or Run option - clears the
  1313. program's variables. GOTO allows you to execute a program or part of a
  1314. program without destroying any variable assignments that may have already
  1315. been made.
  1316.  
  1317. You will use the command line for variety of purposes. There are some
  1318. operations - such as appending a text or program file to a file in memory -
  1319. which can only be performed using commands. You may also want to enter
  1320. commands as an alternative to selecting options from the Superbase
  1321. menus; but it is generally more practical to do this by assigning the
  1322. commands to a function key.
  1323.  
  1324. In addition, the command line is valuable tool for developing and testing
  1325. programs. Particularly useful are commands such as:
  1326.  
  1327.     ? MEMORY
  1328.  
  1329. and
  1330.  
  1331.     ? LIST
  1332.  
  1333. The first command lists the current program's variables and their
  1334. values; the second can be used to display the program listing in the
  1335. database window.
  1336.  
  1337.                 3-6
  1338.  
  1339. EDITING THE COMMAND LINE
  1340.  
  1341. The cursor keys move the cursor in the command line one character at a
  1342. time. Home (Clr Home on the Atari ST) and End (Insert on the Atari ST) take
  1343. the cursor to beginning and end of the command line. Del deletes the
  1344. character in front of the cursor, Backspace deletes the character before.
  1345.  
  1346. If you make a mistake while typing in the command line, you can use these
  1347. keys to correct it. Command lines remain in the box after they have been
  1348. executed and function key commands are placed in the command line box after
  1349. execution, so you may also want to recall the previous command for editing.
  1350.  
  1351. LOADING A PROGRAM
  1352.  
  1353. To load a program from disk into the Program Editor, select Open from the
  1354. Program menu. A file dialog will appear, listing the names of the program
  1355. files in the current directory. You can then select a file in the usual
  1356. way. If you want to load a program in another directory or on another disk,
  1357. type in the file name preceded by the path name.
  1358.  
  1359. To append a program on disk to program in memory, select the Command option.
  1360. Then enter:
  1361.  
  1362.     LOAD "programname", APPEND
  1363.  
  1364. where "programname" is the name of the program on disk which is to be
  1365. joined to the current program.
  1366.  
  1367. Most of the programs you run will have been created in the Program Editor.
  1368. However, it also possible to load a program which has been written in a
  1369. word processor, or has been created in another program editor. In this
  1370. case, there are two requirements: the program file must have an '.sbp'
  1371. extension, and it must be an ASCII file.
  1372.  
  1373. Note that Open loads a program into the Program Editor, but it does not
  1374. open the Program Editor window. If the window is closed and you wish to
  1375. edit a program after loading it, select Edit.
  1376.  
  1377. SAVING A PROGRAM
  1378.  
  1379. Save on the Program menu saves the current program on disk. When you select
  1380. this option. Superbase displays a dialog where you type in the name under
  1381. which the program is to be saved.
  1382.  
  1383.                 3-7
  1384.  
  1385. Normally, programs are saved on disk in 'tokenized' form; instead of storing
  1386. each character in a keyword, Superbase represents keywords using single
  1387. character tokens (keywords are represented in this way internally as well
  1388. as on disk). To save a program as an ASCII file, enter in the command line:
  1389.  
  1390.     SAVE "program name", TEXT
  1391.  
  1392. ASCII program files can be loaded back into the Program Editor and run
  1393. straight away. Note that all program files, both tokenized and ASCII files,
  1394. are given an '.sbp' extension.
  1395.  
  1396. RUNNING A PROGRAM
  1397.  
  1398. Select Run from the Program menu to run the program in memory. If there
  1399. isn't a program in the Program Editor, Run displays the program file
  1400. dialog. When a program has been selected, it is loaded into memory and then
  1401. executed.
  1402.  
  1403. The DML command RUN provides the program equivalent of the menu option. It
  1404. is generally entered as a direct command, but it can also be used within a
  1405. program. As a program command (rather than a direct command), RUN allows
  1406. you to perform a task by linking together a series of programs. When one
  1407. stage has been completed, RUN followed by a program file name will load and
  1408. execute the program which performs the next stage.
  1409.  
  1410. However, the drawback to using RUN for this purpose is that loading and
  1411. executing a new program clears the previous program's variables. If you
  1412. want to link a number of programs together, it usually preferable to use
  1413. the CHAIN command. This provides the same facility as RUN but has the
  1414. advantage that it does not clear any existing variable assignments.
  1415.  
  1416. CREATING A START UP PROGRAM
  1417.  
  1418. One of Superbase's most useful features is the way it lets you specify a
  1419. 'start up' program, which will be automatically loaded and executed when
  1420. you run Superbase. There are many ways in which you can take advantage of
  1421. this feature,  especially if you use Superbase on a regular basis for a
  1422. specific application. All the tasks that you need to perform at the start
  1423. of a session - such as opening files and loading a function key set - can
  1424. be taken care of by the start up program.
  1425.  
  1426.                 3-8
  1427.  
  1428. The procedure for creating a start up program is straightforward. There are
  1429. two requirements:
  1430.  
  1431. The program must be stored in a directory where Superbase will find it:
  1432. either the Start directory as specified in Options on the Set menu (see
  1433. Chapter 7,  Volume 1) or the directory which is current when Superbase is
  1434. loaded; usually this will be the same directory as the Superbase program
  1435. file.
  1436.  
  1437. The program must be saved under the file name Start (this appears on disk
  1438. as Start.sbp).
  1439.  
  1440. When you run Superbase, it looks in the current directory for a program
  1441. with the name Start. If you have specified a Start directory in the '.par'
  1442. file, it then looks for the program in that directory.
  1443.  
  1444. EXAMPLES
  1445.  
  1446. LOAD KEY "Funkey1"
  1447. OPEN FILE "Address"
  1448. OPEN FILE "Customers"
  1449. SET TABLE
  1450. VIEW
  1451.  
  1452. This program loads a function file, opens two database files, set Table
  1453. View, and then displays the first record in the Customers file.
  1454.  
  1455. LOAD KEY "Funkey1"
  1456. NUMBASE "z999999."
  1457. RUN "Prog2"
  1458.  
  1459. After loading a function key file, this program sets the numeric format and
  1460. then loads and executes prog2.
  1461.  
  1462.                 3-9
  1463.  
  1464.             CHAPTER 4 - FUNCTION KEYS
  1465.  
  1466. With Superbase's function key facility, you can create a new set of key
  1467. controls. Each function key may be assigned a string of up to 255
  1468. characters. Depending on the context, Superbase will interpret the string
  1469. either as a command (or sequence of commands) or as text.
  1470.  
  1471. The main applications for this facility are:
  1472.  
  1473. Creating command sequences - one line programs - to provide keyboard
  1474. equivalents for the Control Panel buttons and menu options.
  1475.  
  1476. Creating more complex command sequences which will perform multiple
  1477. operations with a single key-stroke.
  1478.  
  1479. Inserting often-used words, keywords, phrases, and paragraphs in a text
  1480. document or a program.
  1481.  
  1482. The number of functions keys you can define depends on which version of
  1483. Superbase is used. All versions provide the function keys F1 to F10. In
  1484. addition, Amiga and Atari owners can use the Help key, which may be
  1485. regarded as key F0. Another set of ten function keys is available when you
  1486. use F1 to F10 in combination with the Shift key. On Gem versions of
  1487. Superbase running under MS DOS, you can also use the CTRL and Alt keys in
  1488. combination with the keys F1 to F10.
  1489.  
  1490. To summarize these differences:
  1491.  
  1492. 21 function keys are available to Amiga and Atari owners; F1 to F10 plus
  1493. Help, and Shift F1 to Shift F10.
  1494.  
  1495. MS DOS computers have 40 function keys; F1 to F10, and the same keys in
  1496. combination with Shift, CTRL or Alt.
  1497.  
  1498. SETTING A FUNCTION KEY
  1499.  
  1500. There are two ways of setting a function key: using the Set Menu option
  1501. Function keys (Function keys Edit on the Amiga), and using the DML command
  1502. KEY. With the first method, you select Function keys from the Set menu. You
  1503. will then be presented with the Function key dialog (see next page).
  1504.  
  1505. This shows the dialog for GEM versions of Superbase running under MS DOS.
  1506. Atari versions have three keys at the right: Help, Down arrow and Up arrow.
  1507. In both 
  1508.  
  1509.                 4-1
  1510.  
  1511. MS DOS and Atari versions, the Up arrow symbol is used to represent the
  1512. Shift key. The Down arrow represents Shift off; clicking on this key
  1513. highlights it and turn Shift off.
  1514.  
  1515. On the Amiga, the four keys at the right of the panel are replaced by the
  1516. HELP and Shift keys.
  1517.  
  1518. On entry to the dialog, the F1 key is highlighted (as is the down arrow key
  1519. on GEM versions). Clicking on one of the other keys, F2 to F10 (and HELP on
  1520. the Amiga and Atari), highlights the key, making it available for setting.
  1521. You can then assign a string to the key by typing it in the entry box
  1522. below. Click in the box first if the cursor is not shown.
  1523.  
  1524. Clicking on Shift (or the Up arrow symbol) highlights it; you can now assign
  1525. a string to one of the key combinations Shift F1 to Shift 10. For the Amiga
  1526. and the Atari, the Shift key is the only one that can be used in
  1527. combination with the keys F1 to F10 - Shift HELP is the same HELP on its
  1528. own. On MS DOS  machines, you also have the choice of selecting CTRL and
  1529. ALT. This makes available the key ranges CTRL F1 to CTRL F10 and ALT F1 to
  1530. F10.
  1531.  
  1532. When you have set the functions keys you require, click on OK. This action
  1533. will assign the strings you have entered to their respective keys and then
  1534. remove the dialog.
  1535.  
  1536. The other method of setting the function keys is to use the DML command KEY
  1537. - either from the Command Line or from a program. Consult the keyword
  1538. reference entry under KEY for an explanation of how to use this command.
  1539.  
  1540. FUNCTION KEYS FOR COMMANDS
  1541.  
  1542. As we mentioned earlier, Superbase treats function key assignments as
  1543. commands or text according to the circumstances. If one of the editing
  1544. cursors is active, a function key string is interpreted as text; if a cursor
  1545. is not present, 
  1546.  
  1547.                 4-2
  1548.  
  1549. a string is executed as a command. There are three circumstances in which
  1550. an editing cursor may be active: when you are editing a document in the
  1551. Text Editor, or a program in the Program Editor, and when you are editing a
  1552. field in record edit mode.
  1553.  
  1554. The rules governing the commands which can assigned to function keys are
  1555. the same as for the Command Line (see Chapter 3). If the commands can be
  1556. executed as a one line program, they can also be assigned to a function
  1557. key. Note that single word commands at the beginning of a function key
  1558. string must have a trailing space if followed by a colon.
  1559.  
  1560. EXAMPLES
  1561.  
  1562. The following function key strings show how you can create keyboard
  1563. equivalents for the Control panel buttons:
  1564.  
  1565. SELECT FIRST: VIEW
  1566.  
  1567. This has the same effect as clicking on the First record button.
  1568.  
  1569. SELECT LAST: VIEW
  1570.  
  1571. Equivalent to the Last Record button.
  1572.  
  1573. a%=0: a$=" ": REQUEST "Locate key", "", 4, a%, a$, 20:
  1574. IF a$ <> " " THEN SELECT KEY a$: VIEW
  1575.  
  1576. Equivalent to the Key Lookup button. The REQUEST command is not necessary
  1577. for this purpose, but it allows you to display a customized dialog, making
  1578. the operation of using an index key easier to perform.
  1579.  
  1580. It is worth pointing out that the command KEY lists all the current
  1581. function key assignments to the current output device. You may find it
  1582. useful to assign this command to one of the function keys. Enter the single
  1583. KEY as the function key string. Pressing the key will then show you at
  1584. glance what the settings are for the other keys.
  1585.  
  1586. FUNCTIONS KEYS FOR TEXT AND PROGRAM ENTRY
  1587.  
  1588. In text entry, Function keys are useful for entering text strings which
  1589. occur many times in the same document or are regularly used in different
  1590. documents. They save you the trouble of having to type in the string
  1591. yourself every time it is needed. Provided the text cursor is shown on
  1592. screen, pressing a function key will insert a string at the point where the
  1593. cursor is located.
  1594.  
  1595. The same applies to the use of function keys in program entry. You can
  1596. define function keys to insert commonly used keywords in a program. For
  1597. example, you
  1598.  
  1599.                 4-3
  1600.  
  1601. might want to define the keys F1 to F5 as:
  1602.  
  1603. REM
  1604. LOAD "
  1605. SAVE "
  1606. OPEN FILE "
  1607. WHILE
  1608.  
  1609. Keys F5 to F10 could then be assigned commands which are useful during
  1610. program development (you would have to activate the database window before
  1611. these could be executed):
  1612.  
  1613. MEMORY
  1614. RUN
  1615. PAGING ON: ? LIST
  1616. EDIT
  1617. STATUS
  1618.  
  1619. If you wish to assign a text string that runs over several lines, you need
  1620. to use the carriage return character. However, it is not possible to enter
  1621. this character in the Function keys dialog, so you must enter it using the
  1622. KEY command in a program or in the Command Line. Thus to assign an address
  1623. to F1,  you enter a string like this:
  1624.  
  1625. KEY 1, "6 Park Terrace " + CHR$ (13) + "Worcester Park" +
  1626. CHR$ (13) + "Surrey KT4 7 JZ" + CHR$ (13)
  1627.  
  1628. NOTE: In most cases, function key strings which are intended for text entry
  1629. cannot be executed as commands. Pressing a function key of this type when
  1630. the cursor is not active may cause an error message.
  1631.  
  1632. EDITING A FUNCTION KEY STRING
  1633.  
  1634. If a function key has already been set, selecting the Function keys option
  1635. (Function keys Edit on the Amiga) from the Set menu displays the contents
  1636. of the key in the string entry box. Initially, the setting for the F1 key
  1637. will be shown. In Gem versions, when you select another key, Superbase
  1638. displays the setting for that key.
  1639.  
  1640. If you wish to change the current setting, you can do so using the same
  1641. editing controls as for the Command Line: cursor keys, Backspace, Del, Home
  1642. and End. Alternatively, click on Clear to remove the current setting and
  1643. type in a new function key string.
  1644.  
  1645. Remember to press the Return key after editing a function key; otherwise
  1646. your alterations will not be registered.
  1647.  
  1648.                 4-4
  1649.  
  1650. FUNCTION KEY FILES
  1651.  
  1652. The strings you assign to the functions keys can be saved on disk for use
  1653. in other sessions with Superbase. Function key files are saved as ASCII
  1654. files with the extension '.sbk'. If you wish to examine a function key
  1655. file, you may display it on screen or print it out with the List option on
  1656. the System menu. Notice that any keys which have not been assigned a string
  1657. are shown as blank lines.
  1658.  
  1659. SAVING FUNCTION KEY FILES
  1660.  
  1661. Selecting the Function keys Save option saves the current function key
  1662. settings on disk. Superbase adds the '.sbk' extension to the file name you
  1663. type in. Function keys Save presents you with a file dialog, showing the
  1664. existing '.sbk' files in the current directory. This operates in the same
  1665. way as any other file dialog. If you select a file name from the list -
  1666. instead of typing in a new name - a dialog will appear, asking if you wish
  1667. to overwrite the selected file. You can then click on OK to overwrite, or
  1668. Cancel to halt the operation.
  1669.  
  1670. LOADING FUNCTION KEY FILES
  1671.  
  1672. Select Function keys Load from the Set menu to load a function key file
  1673. from disk. A file dialog will appear showing the '.sbk' files in the
  1674. current directory. After a file has been selected, it is loaded into memory
  1675. and sets the current function keys.
  1676.  
  1677. The LOAD KEY "file name" command is used to load a function key file under
  1678. program control or from the Command Line. Once you have created the
  1679. function key set that meets your requirements, you can include this
  1680. command, followed by the name of the function key file, in the Start
  1681. program (see Creating a Start up program, Chapter 3). This way, the
  1682. function keys will be set up for you as soon as Superbase has loaded.
  1683.  
  1684. Another way of using the LOAD KEY command is to assign it to a function
  1685. key. You will then be able to load a specified function key file with a
  1686. single key press.
  1687.  
  1688.                 4-5
  1689.  
  1690.             CHAPTER 5 - KEYWORD REFERENCE GUIDE
  1691.  
  1692. SYNTAX CONVENTIONS
  1693.  
  1694. This section describes the conventions that have been used in the following
  1695. documentation.
  1696.  
  1697. The general format used to explain each keyword is as follows:
  1698.  
  1699. PURPOSE -a brief description of the keyword.
  1700. SYNTAX - the format of the keyword.
  1701. COMMENTS - explains the format and function of the keyword in more detail.
  1702. EXAMPLES - program examples.
  1703. NOTES - explains the program examples and covers any other points not dealt
  1704. with under the above headings.
  1705.  
  1706. For the syntax of the keyword, the following terms and symbols are used:
  1707.  
  1708. nexpr
  1709.  
  1710. This can be any valid numeric expression consisting of numeric fields, date
  1711. fields, numeric constants and/or numeric results of other keywords. For
  1712. example, if a function expects a numeric argument, you could enter any of
  1713. the following expressions:
  1714.  
  1715.     156        (an integer)
  1716.     156.25        (a floating point number)
  1717.     num%        (a numeric variable)
  1718.     numfield    (the name of a numeric field in a file)
  1719.     3 + 6        (the result of an expression)
  1720.     SQR (25)    (the result of a keyword)
  1721.  
  1722. strexpr
  1723.  
  1724. This can be any string or substring from a text field, external field,
  1725. string variable, text literal or string result of other keywords. For
  1726. example, any of the following expressions would be suitable entries for
  1727. strexpr:
  1728.  
  1729.     "hello"        (a string constant)
  1730.     strfield    (the name of a string field)
  1731.     numfield    (the name of a numeric field)
  1732.     fielda$        (a string variable)
  1733.  
  1734.                 5-1
  1735.  
  1736.     fielda$        (a string variable)
  1737.     Address        (a file name)
  1738.     MID$ ("immediately", 3, 2)  (a calculated result)
  1739.  
  1740. var
  1741.  
  1742. This can be any variable, string or numeric. If the keyword requires
  1743. variables of a particular type, strvar or nvar are used for string or
  1744. numeric variables. Various other conventions - such as fieldname or just
  1745. field - are used to indicate particular data types. These should be
  1746. self-explanatory.sbfile, for example, means that you should enter the name
  1747. of a database file; on disk,  Superbase identifies database files by an .sbf
  1748. extension, but you should not include the extension name when you use it in
  1749. a DML command.
  1750.  
  1751. Any parameters or arguments contained in parentheses are compulsory
  1752. (including any commas), while those within square brackets- '['and']' - are
  1753. optional. All other arguments are compulsory. For instance, supposing the
  1754. syntax for a keyword is given as:
  1755.  
  1756.     XXX (strexpr$, nexpr[.nexpr2])
  1757.  
  1758. This means that strexpr and nexpr are required with the keyword XXX and
  1759. that they must be separated by a comma. The next argument, nexpr2, is
  1760. optional, but if used must be separated from the second argument by a
  1761. comma.
  1762.  
  1763. The '/' character is used to indicate a number of alternatives. For
  1764. example:
  1765.  
  1766.     CLOSE ALL/FILE sbfile
  1767.  
  1768. The syntax for this statement indicates that CLOSE can be followed by
  1769. either ALL or FILE, but not both at the same time.
  1770.  
  1771.                 5-2
  1772.  
  1773. ? COMMANDS
  1774.  
  1775. ? is a general purpose output command. You can use it to display
  1776. information on screen, or to send information to the printer, or to create
  1777. a file on disk. When ? is followed by a list of expressions - text,
  1778. numbers, variables, fields, etc it sends the expressions to the current
  1779. output device. It can also be used with the following keywords:
  1780.  
  1781.     DIRECTORY
  1782.     LIST
  1783.     MEMORY
  1784.     QUERY
  1785.     STATUS
  1786.     TEXT
  1787.  
  1788. These keywords have a specific function when used with ?, and have been
  1789. treated as separate commands. You will find an entry for each of them
  1790. further on in this section.
  1791.  
  1792. CHANGING THE OUTPUT DEVICE
  1793.  
  1794. When you load Superbase, the ? command takes the screen as the default
  1795. device and works in the same way as the PRINT command does in other
  1796. versions of Basic - it displays information on screen. If you want to
  1797. direct output to another device use one of these commands first:
  1798.  
  1799.     PARAMETER        PURPOSE
  1800.     PRINT            for the printer
  1801.     OUTPUT TO        for the disk drive
  1802.     DISPLAY            to switch back to the screen
  1803.  
  1804. ? then continues to output to the device selected by one of these commands.
  1805. CLS and HOME do not reset the current output device.
  1806.  
  1807. PRINT and DISPLAY can be followed by a list of expressions which will then
  1808. be output to the devices associated with these commands. When you use PRINT
  1809. and DISPLAY simply to change the current output device, they should be
  1810. followed by a semicolon, as in:
  1811.  
  1812.     PRINT;
  1813.  
  1814. which directs all future output to the printer.
  1815.  
  1816. OUTPUT TO needs a filename after it, as in:
  1817.  
  1818.     OUTPUT TO "texta"
  1819.  
  1820. which directs output to a file on disk named 'texta'.
  1821.  
  1822.                 5-3
  1823.  
  1824. OUTPUT FORMAT PARAMETERS
  1825.  
  1826. After outputting a list of expressions, the ? command starts a new line
  1827. unless you specify otherwise. This means that it takes the cursor to the
  1828. beginning of the next line (if the current output device is the screen).
  1829. You can instruct DML to output the next list of expressions on the same
  1830. line, by placing a semicolon at the end of an expression list. When it is
  1831. used in this way, the semicolon is known as an output format parameter, and
  1832. is one of a number of parameters that allow you to specify how output is
  1833. formatted.
  1834.  
  1835. Apart from the semicolon, you place these parameters in front of the
  1836. expressions that you want to format. Thus you can place them at the front
  1837. of the line immediately after the ? character, and you can also insert them
  1838. in the middle of an expression list.
  1839.  
  1840. Some output parameters are keywords such as BF and DOWN, and others are
  1841. symbols such as the semicolon itself and the @ sign. If you use keyword
  1842. parameters, they must separated from each other by spaces. For example, DML
  1843. will accept a line like this:
  1844.  
  1845.     ? UL BF IT "One", , "TWO' UL OFF @5, 10"Three"
  1846.  
  1847. but it will not accept
  1848.  
  1849.     ? ULBFIT"One", , "Two"ULOFF@5, 10"Three"
  1850.  
  1851. The output format parameters for the ? command are:
  1852.  
  1853. PARAMETER        PURPOSE
  1854.  
  1855. &            Sets length of text string
  1856. @            Sets row and column position
  1857. ,             Outputs a space
  1858. ;            Used as a separator and to suppress new line
  1859. DOWN            Outputs each item on a new line
  1860. ALL            Outputs all the fields in the current record
  1861. NEWLINE            Starts a new line
  1862. BF[ON]            Sets text to bold face
  1863. UL[ON]            Underlines text
  1864. IT[ON]            Sets text to italic
  1865. BF/UL/IT OFF        Turns selected text attribute off
  1866. ATTR OFF        Turns all text attributes off
  1867. FG (Amiga only)        Sets foreground color
  1868. BF (Amiga only)        Sets background color
  1869. SAY (Amiga only)        Speaks output
  1870. EJECTnn            Outputs data on a new page if there are less than
  1871.             nn lines left at the bottom of the page
  1872.  
  1873.                 5-4
  1874.  
  1875. COMMENTS
  1876.  
  1877. The @ sign, followed by a numeric expression, specifies the column and row
  1878. position for your output. For example, if the screen is the output device
  1879. selected:
  1880.  
  1881.     ? @12, 7"Smith"
  1882.  
  1883. displays the name Smith on the screen at column 12, row 7. As an
  1884. alternative to using @, see LOCATE.
  1885.  
  1886. DML treats a comma as a space character. For example:
  1887.  
  1888.     ? "Hello", , , "goodbye"
  1889.  
  1890. outputs
  1891.  
  1892.     Hello   goodbye
  1893.  
  1894. Placing a semicolon after the last expression in the output list prevents
  1895. DML from outputting a new line character. For example:
  1896.  
  1897.     ? "Hello": ? "there"
  1898.  
  1899. outputs them on the same line as
  1900.  
  1901.     Hello there
  1902.  
  1903. Note that when the output device is the screen, DML only outputs the
  1904. expressions in a list when it starts a new line. For example, if you enter
  1905. the line:
  1906.  
  1907.     ? "one"; "two"; "three";
  1908.  
  1909. nothing will appear on the screen until you enter another line which does
  1910. not have a semicolon at the end of it.
  1911.  
  1912. If used, DOWN must be placed at the front of a line, before the line's
  1913. expressions and after the ? character. It ensures that each expression in
  1914. the list is output on a new line. For example:
  1915.  
  1916.     ? DOWN "one"; "two"; "three"
  1917.  
  1918. nothing will appear on the screen until you enter another line which does
  1919. not have a semicolon at the end of it.
  1920.  
  1921. If used, DOWN must be placed at the front of a line, before the line's
  1922. expressions and after the ? character. It ensures that each expression in
  1923. the list is output on a new line. For example:
  1924.  
  1925.     ? DOWN "one"; "two"; "three"
  1926.  
  1927. formats the output on screen as
  1928.  
  1929.     one
  1930.     two
  1931.     three
  1932.  
  1933.                 5-5
  1934.  
  1935. When Down is used to format field data, it displays the field names in inverse
  1936. video at the left of the data - in same way as Record View displays a record.
  1937. ALL outputs the fields in the current record; for example, if the screen is the
  1938. current output device:
  1939.  
  1940.     ? DOWN ALL
  1941.  
  1942. would have the same effect as clicking on the current record button when
  1943. Record View is selected.
  1944.  
  1945. NEWLINE instructs DML to start a new line. Thus
  1946.  
  1947.     ? "one", "two"NEWLINE "three"
  1948.  
  1949. outputs the expressions as
  1950.  
  1951.     one two
  1952.     three
  1953.  
  1954. NEWLINE can also be used on its own - see NEWLINE, Keyword Reference.
  1955.  
  1956. BF, UL, and IT set the text style for output.
  1957. BF    sets boldface
  1958. UL    sets underline
  1959. IT     sets italic
  1960.  
  1961. Each of these can be set by ON (which is optional) and cleared by OFF.
  1962.  
  1963. ATTR OFF clears all the text style attributes.
  1964.  
  1965. For example:
  1966.  
  1967.     ? BF"Bold face on"; IT "italics on"; BF OFF IT OFF "Bold and italics
  1968. off" On the Amiga you can also set the foreground and background colours,
  1969. using FG and BG. Each takes a parameter in the range 1 to 4 for the four
  1970. colours set by Preferences. For example:
  1971.  
  1972.     ? FG 2 BF 1 "Foreground colour 2, background colour 1"
  1973.  
  1974. SAY, which is only available on the Amiga, uses the Amiga's narrator device
  1975. to speak the items in an expression list. Thus if you wanted to speak the
  1976. field names and field data for the current record, you would enter:
  1977.  
  1978.     ? SAY DOWN ALL
  1979.  
  1980. EJECT can be used to ensure that a group of data items - the fields in a
  1981. record, for example - all appear on the same page. For example:
  1982.  
  1983.                 5-6
  1984.  
  1985.     ? DOWN "One"; "Two"; "Three"; "Four" EJECT 4
  1986.  
  1987. displays a new page if there is not enough room at the bottom for the four
  1988. items in the expression list.
  1989.  
  1990.                 5-7
  1991.  
  1992. ?
  1993.  
  1994. PURPOSE
  1995.  
  1996. Sends information to a device.
  1997.  
  1998. SYNTAX
  1999.  
  2000. ? [@nexpr] [; expr; expr, ....]
  2001.  
  2002. COMMENTS
  2003.  
  2004. Used to send one or more expressions (an expression list) to the current
  2005. output device. ? can also include any of the output format parameters.
  2006.  
  2007. When you output numeric, date, and time constants or the results of
  2008. functions for these data types, they take the format which has been set
  2009. with the Number or Date/Time format options on the Set menu (or with the
  2010. commands NUMBASE and DATEBASE). Field data is output in the format set in
  2011. the file definition. However, you can force Superbase to output field data
  2012. in the current format by enclosing the field name in brackets. Thus:
  2013.  
  2014.     ? (numfielda), (datefielda)
  2015.  
  2016. displays the contents of these fields in the current numeric and date
  2017. formats rather than in the formats they have been given in the file
  2018. definition.
  2019.  
  2020. EXAMPLES
  2021.  
  2022. 1    ? "Hello"
  2023. 2    ? "Hello"; a$
  2024. 3    ? UL BF "Hello"; a$; NEWLINE b$
  2025. 4    ? "The square root of"; n%; "is"; SQR (n%
  2026. 5    ? "One""two""three"
  2027.  
  2028. NOTES
  2029.  
  2030. Depending on the numeric format that has been set, example 4 would output
  2031. the numeric expressions, n% and SQR (n%), with leading spaces. To remove
  2032. these, you would have to use the STR$ and LTRIM$ functions.
  2033.  
  2034. You will notice that there are no semicolons separating the expressions in
  2035.  
  2036.                 5-8
  2037.  
  2038. example 5. It is not always to place a semicolon between two expressions.
  2039. Provided DML has some other way of telling where one expression ends and
  2040. the other one starts, you can omit the semicolon. In this example the
  2041. quotation marks allow DML to distinguish between the three expressions.
  2042.  
  2043. ? DIRECTORY
  2044.  
  2045. PURPOSE
  2046.  
  2047. Lists the current directory to an output device.
  2048.  
  2049. SYNTAX
  2050.  
  2051. [?] DIRECTORY
  2052.  
  2053. COMMENTS
  2054.  
  2055. When the screen has been selected as the current output device, the
  2056. directory is listed in two columns in alphabetic order. If the output
  2057. device is the printer or a disk file, the directory is listed in single
  2058. column.
  2059.  
  2060. The "?" command is optional - DIRECTORY on its own has the same effect.
  2061.  
  2062. ? LIST
  2063.  
  2064. PURPOSE
  2065. List a program in memory to an output device.
  2066.  
  2067. SYNTAX
  2068. ? LIST
  2069.  
  2070. COMMENTS
  2071.  
  2072. Do not confuse this command with LIST, which displays a text file on
  2073. screen. ? LIST has several applications. You can use it to examine a
  2074. program listing by displaying it on screen on printing it out; and, when the
  2075. current output device is the disk drive, it allows you to save a program as
  2076. a text file. In this last application, it has the same effect as:
  2077.  
  2078.     SAVE "program name", TEXT
  2079.  
  2080.                 5-9
  2081.  
  2082. ? MEMORY
  2083. PURPOSE
  2084.  
  2085. Sends information about any defined variables to an output device.
  2086.  
  2087. SYNTAX
  2088.  
  2089. [?] MEMORY
  2090.  
  2091. COMMENTS
  2092.  
  2093. This outputs the variables in memory as:
  2094.  
  2095.     a%=123.46
  2096.     b%=12.00
  2097.     a1$="aaaaaaaaaaaaaa bbbbbbbb"
  2098.     etc.
  2099.  
  2100. The variables are output in the order in which they were assigned. If you
  2101. specify OUTPUT TO file, the values of the variables can be recovered for a
  2102. subsequent program by the SET file command.
  2103.  
  2104. The "?" command is optional - MEMORY on its own has the same effect.
  2105.  
  2106. ? QUERY
  2107. PURPOSE
  2108.  
  2109. Runs the current Query in memory and sends the results to an output device.
  2110.  
  2111. SYNTAX
  2112. ? QUERY
  2113.  
  2114. COMMENTS
  2115.  
  2116. Query has four output options (on the Amiga, SAY provides a fifth option).
  2117. You can send the output from a Query to the screen, the printer, to disk
  2118. (as an ASCII file) or to file (as an '.sbf' file). However, when you save a
  2119. Query, the currently selected output option is not saved with the rest of
  2120. the Query settings; so if you run a Query under program control, you will
  2121. need to select the output device beforehand.
  2122.  
  2123. To send output to the printer, either set the Printer option from the Set
  2124. menu,  or issue a PRINT; command. To send output to disk, you should use the
  2125. OUTPUT TO filename or OPEN filename FOR OUTPUT commands.
  2126.  
  2127.                 5-10
  2128.  
  2129. The Query output will then be stored on disk under file name specified.
  2130.  
  2131. EXAMPLES
  2132.  
  2133. 1    LOAD QUERY "Stockrep"
  2134.     PRINT;
  2135.     ? QUERY
  2136. 2    LOAD QUERY "Addreport"
  2137.     OPEN "Addrep.asc" FOR OUTPUT
  2138.     ? QUERY
  2139.  
  2140. NOTES
  2141.  
  2142. In the first example, output from the Stockrep Query is directed to the
  2143. printer; in the second example, output from the Addreport query is used to
  2144. create an ASCII file on disk under the name Addrep.asc.
  2145.  
  2146. ? STATUS
  2147. PURPOSE
  2148. Sends information about the System Status
  2149.  
  2150. SYNTAX
  2151. [?]STATUS[FILE sbfname]
  2152.  
  2153. COMMENTS
  2154.  
  2155. ? STATUS without the FILE option gives the same output as the menu option
  2156. System Status. If no Superbase files ('.sbf' files) are open, it displays
  2157. the following information:
  2158.  
  2159.     Memory free
  2160.     Diskspace Free
  2161.     Current Directory Name
  2162.     Superbase Files open (as 0)
  2163.     Superbase Files available.
  2164.  
  2165. If any database files are open, the header information for these files is
  2166. also shown.
  2167.  
  2168.     ? STATUS FILE sbfname
  2169.  
  2170. gives the same output as the menu option SYSTEM STATUS FILE, and
  2171.  
  2172.                 5-11
  2173.  
  2174. produces a status report for the file. At the top of the report, it shows
  2175. file statistics such as the number of records and the file size. Below this,
  2176. it shows the file definition details: for each field, it lists the field
  2177. name, its attributes, format, Form View location, and any associated
  2178. calculation or validation formula.
  2179.  
  2180. If the file is not open, the error message 'Can't do this / File not open'
  2181. appears.
  2182.  
  2183. The '?' command is optional with STATUS - using STATUS on its own has the
  2184. same effect.
  2185.  
  2186. ? TEXT
  2187. PURPOSE
  2188. Sends a text file in memory to an output device.
  2189.  
  2190. SYNTAX
  2191. ? TEXT[MERGE]
  2192.  
  2193. COMMENTS
  2194.  
  2195. This command outputs the current text file in the Text Editor. If the text
  2196. file is a form letter and its associated database file has been opened,
  2197. adding the MERGE command will merge the data in the current record with the
  2198. text file. See also the Keyword Reference entry for MERGE.
  2199.  
  2200. EXAMPLES
  2201.  
  2202. 1     OPEN FILE "Address"
  2203.       LOAD TEXT "Maillet"
  2204.     ? TEXT MERGE
  2205.  
  2206. NOTES
  2207.  
  2208. If the current output device is the screen, this example will insert the
  2209. data from the first record (in the Address file) into the Maillet text
  2210. file, and display the result in the database window.
  2211.  
  2212.                 5-12
  2213.  
  2214. ABS
  2215. PURPOSE
  2216.  
  2217. Turns negative numbers into positive numbers but leaves positive numbers
  2218. unchanged.
  2219.  
  2220. SYNTAX
  2221. ABS (nexpr)
  2222.  
  2223. COMMENTS
  2224.  
  2225. ABS returns the 'absolute' value of a number. In effect, it simply strips
  2226. the sign off a negative number, making it positive. One of its common uses
  2227. is for calculating the difference between two numbers when you do not know
  2228. which is larger. In example 2, which works out the number of days between
  2229. two dates, ABS allows you to enter the dates without first knowing which is
  2230. the later date.
  2231.  
  2232. EXAMPLES
  2233.  
  2234. 1    numfieldc=ABS (numfielda)
  2235. 2    numfieldc=ABS (datefielda-datefieldb)
  2236. 3    numfieldc>ABS (numfielda * numfieldb)
  2237. 4    x%=ABS (y%)
  2238. 5    x%=ABS (y% * numfielda * (datefielda-datefieldb))
  2239. 6    x%=ABS (VAL (RIGHT$ (textfielda, 5)))
  2240. 7    ? ABS (x%)
  2241.  
  2242.                 5-13
  2243.  
  2244. ADD
  2245. PURPOSE
  2246. Adds a new field to a file definition.
  2247.  
  2248. SYNTAX
  2249.  
  2250. ADD[FILE sbfname]field-definition-string[formula-string][formula-string]
  2251.  
  2252. COMMENTS
  2253.  
  2254. This command is used in conjunction with CREATE and MAKE to create a new
  2255. Superbase database file. It cannot be used to add a field to an existing
  2256. file. To use ADD correctly, you need to understand how a file definition is
  2257. set up. The best way to do this is to use the STATUS FILE option in
  2258. Superbase's System menu. This will show you the file definition for the
  2259. current file. Another way of viewing the same information would be to list
  2260. an '.sbd' file on screen using the System menu's LIST option.
  2261.  
  2262. With one exception, the parameters used with ADD to define a field are the
  2263. same as those used in '.sbd' file definitions. The exception is '>' and
  2264. '>>'. These are used in '.sbd' files to indicate that there are one or two
  2265. formula lines to follow. You do not need to include these characters in a
  2266. field definition string.
  2267.  
  2268. From left to right, the field definition string is composed of the
  2269. following parameters:
  2270.  
  2271. fieldname
  2272. fieldtype[other fieldtype parameters]
  2273. format[case and multiple response parameter for text fields]
  2274. row; col
  2275.  
  2276. Each of these parameters must take the same form as it does in an 'sbd'
  2277. file. fieldname must conform to the rules for fieldnames. Fieldtype must be
  2278. one of the following:
  2279.  
  2280. TXT    text
  2281. EXT    external
  2282. NUM    numeric
  2283. DAT    date
  2284.  
  2285.                 5-14
  2286.  
  2287. TIM    timefield
  2288. DEL    deleted
  2289.  
  2290. The other fieldtype parameters are optional and, if used, are separated
  2291. from fieldtype and each other by at least one space. You can specify up to
  2292. three of these parameters, selecting one from each of the following groups:
  2293.  
  2294. A)
  2295. CLC    Calculated
  2296. CLV    Calculated and validated
  2297. CON    Constant
  2298. COV    Constant and validated
  2299. VAL    Validated
  2300.  
  2301. B)
  2302. RDO    Read only
  2303. RDQ    Read only required
  2304. REQ    Required
  2305.  
  2306. C)
  2307. IXU    Indexed - Unique
  2308. IXD    Indexed - Normal
  2309.  
  2310. format specifies the length of a field and the numeric format for numeric
  2311. fields, format must be appropriate for the field type. For example, 20 for
  2312. TXT, z99999.00 for NUM, ddmmmyy for DAT.
  2313.  
  2314. The case parameter can be U, L or C, depending on whether the text data is
  2315. to shown in upper case, lower case or with the first letter capitalized.
  2316. The multiple response parameter is M followed by the number of elements in
  2317. the multiple response field (maximum 9). These parameter are optional and
  2318. can only be used with text fields. They must be separated from the field
  2319. format by at least one space. For example, to define a text field with
  2320. three multiple response fields, each up to 15 characters long, you would
  2321. enter these parameters:
  2322.  
  2323.     15 M3;
  2324.  
  2325. If you also wanted the field data to be in upper case, you would enter:
  2326.  
  2327.     15 UM3;
  2328.  
  2329. row is the row position for FORM-view (maximum 255).
  2330. col is the column position for FORM-view (maximum 255).
  2331.  
  2332.                 5-15
  2333.  
  2334. row and col are optional, but you are strongly recommended to use them. If
  2335. they are not used, all the fields will be positioned at the top left of the
  2336. screen on top of one another when the record is displayed in Form View.
  2337.  
  2338. The field types in group A-CLC, CLV, CON, COV, VAL-must be followed by a
  2339. formula or formulas. CLV and COV require two formulas; the formula for
  2340. constants or calculations should be come first, followed by the validation
  2341. formula. Formulas should be enclosed in quotation marks and must be
  2342. separated by commas from the first part of the field definition string and
  2343. from each other.
  2344.  
  2345. Formula-string must follow the rules (given in Volume 1) for using formulas
  2346. for calculations, constants and validations.
  2347.  
  2348. Since formulas must be enclosed in quotation marks, DML will be confused if
  2349. a formula itself contains quotation marks, as in:
  2350.  
  2351.     fielda LIKE "[a-c]*"
  2352.  
  2353. The simplest solution here is to use the tilde character '~' in place of
  2354. quotation marks. When you execute the ADD command, DML will interpret the
  2355. tilde as a quotation mark.
  2356.  
  2357. An alternative solution is to use the CHR$ function to insert quotation
  2358. marks the ASCII code for quotation marks is 34. Thus the line to set up a
  2359. validated field called fielda of length 12 at row 5, column 20 would be:
  2360.  
  2361.     ADD"fielda; TXT VAL; 12, 5; 20", "fielda LIKE" + CHR$ (34)
  2362.     + "[a-c]*" + CHR$ (34)
  2363.  
  2364. In the unlikely event that your formula actually requires a tilde
  2365. character,  you can insert it in a string variable using CHR$ (126).
  2366.  
  2367. Note that the maximum length for a program line is 255 characters. Since a
  2368. formula can also be up to 255 characters long, you may be unable to enter
  2369. the entire field definition on a line. The solution is to assign formulas
  2370. to string variables beforehand. For example:
  2371.  
  2372.     a$="Price.Orders * Quantity.Orders"
  2373.     ADD "Subtotal; NUM; $9999999.00; 5, 20", a$
  2374.  
  2375. EXAMPLES
  2376.  
  2377. 1 ADD "aatext; TXT REQ IXU; 20 M3; 1, 12"
  2378. 2 ADD "aanumb; NUM; z999999.00; 1, 40"
  2379. 3 ADD "bbtext; TXT CLC RD0; 10; 2, 12", "UCASE$ (LEFT$ (aatext, 10))"
  2380.  
  2381.                 5-16
  2382.  
  2383. 4 ADD "fielda; TXT VAL; 12; 15; 20", "fielda LIKE " + CHR$ (34) + "[a-c]*"
  2384.   + CHR$ (34)
  2385.  
  2386. NOTES
  2387.  
  2388. Creating a file under program control is a three stage process involving
  2389. CREATE, ADD, and MAKE. For a description of the process, see CREATE.
  2390.  
  2391. AFTER GROUP
  2392.  
  2393. PURPOSE
  2394. Set after group activity with reports.
  2395.  
  2396. SYNTAX
  2397. AFTER GROUP fieldname
  2398.  
  2399. COMMENTS
  2400.  
  2401. When you create a report using the Forms Editor's reporting facility,
  2402. Superbase generates a Report program for you. The AFTER GROUP statement is
  2403. used within a Report program to mark the start of an AFTER GROUP section.
  2404. This consists of a series of "?" statements which specify the information
  2405. that is output every time a group changes. Each statement corresponds to a
  2406. line in the AFTER GROUP box in the Forms Editor.
  2407.  
  2408. fieldname identifies the group and must be name of a field which has
  2409. previously been defined as a group with the GROUP statement. An AFTER GROUP
  2410. section must end with an END REPORT statement.
  2411.  
  2412. EXAMPLES
  2413.  
  2414. 1     AFTER GROUP Lastname.Clients
  2415.     ? BF ?Client", GROUP, "has"; COUNT amount; "Deposits"
  2416.     ? BF "Total deposits are", @25SUM amount
  2417.     ? BF "Maximum is", @s5 MAX amount
  2418.     ? BF "Minimum is", @25 MIN amount
  2419.     END REPORT
  2420.  
  2421. NOTES
  2422.  
  2423. In the second line of this example, the keyword GROUP is used in order to
  2424.  
  2425.                 5-17
  2426.  
  2427. retrieve the name of the last group. At this point, the group has already
  2428. changed; so, Lastname.Clients could not be used instead of GROUP because it
  2429. would output the name of the current group.
  2430.  
  2431. EXAMPLES
  2432.  
  2433. 1    AFTER REPORT
  2434.     ?@1, 3; UL "Statistics for the Report", UL OFF: ?
  2435.     ?"Total amount is", @30 SUM amount
  2436.     ?"Number of deposits", @30 COUNT amount
  2437.     ?"Average amount", @30 MEAN amount
  2438.     END REPORT
  2439.  
  2440. ASC
  2441. PURPOSE
  2442. Returns the ASCII value of a single character.
  2443.  
  2444. SYNTAX
  2445. ASC (strexpr)
  2446.  
  2447. COMMENTS
  2448. ASC gives a numeric value-the ASCII code-for the text character in
  2449.  
  2450.                 5-18
  2451.  
  2452. strexpr. When strexpr is longer than one character ASC returns the ASCII
  2453. code of the leftmost character of strexpr. Appendix E, Volume 1, gives the
  2454. ASCII characters and their decimal codes. The complementary function of ASC
  2455. is CHR$.
  2456.  
  2457. EXAMPLES
  2458.  
  2459. 1    numfieldc=ASC (textfielda)
  2460. 2    numfieldc=ASC (RIGHT$ (textfielda, 1))
  2461. 3    ASC (textfielda) > 64 AND ASC (textfielda) < 91
  2462. 4    x%=ASC ("A")
  2463. 5    x%=ASC (x$)
  2464. 6    x%=ASC (UCASE$ (MID$ (nextfield, 3, 1)))
  2465. 7    ?ASC (x$)
  2466.  
  2467. NOTES
  2468. Example 3 provides one way of validating a text field to ensure that the
  2469. first character is uppercase (but see FCASE$).
  2470.  
  2471. ASK
  2472. PURPOSE
  2473. Inputs a character string from the keyboard.
  2474.  
  2475. SYNTAX
  2476. ASK[pos] [string] [&length]; var/field
  2477.  
  2478. COMMENTS
  2479.  
  2480. This command allows the user to enter information from the keyboard into
  2481. the computer while a program is running. It expects the user to type in one
  2482. or more characters, and, as soon as the Return key is pressed, reads them
  2483. into a variable or a field.
  2484.  
  2485.                 5-19
  2486.  
  2487. string can be used to include a prompt message.
  2488.  
  2489. pos gives the position of the prompt text and input string. It uses the @
  2490. output format parameter to specify the column position, followed by the row
  2491. position. If pos is not given then the input string appears on the row
  2492. where the cursor is currently located.
  2493.  
  2494. &length limits the length of the input and shows the maximum length on
  2495. screen using an 'end-of-field' marker.
  2496.  
  2497. The input can be assigned to a variable or a field (in a currently open
  2498. file). If the field is not in the current file, it can be specified with
  2499. the filename extension.
  2500.  
  2501. var or field can be either string or numeric variables or fields, and they
  2502. must match the type of input expected: a string variable will accept
  2503. whatever you type in, but a numeric variables when you input non-numeric
  2504. data such as letters. The same restriction applies to numeric fields.
  2505.  
  2506. EXAMPLES
  2507.  
  2508. 1    ASK; x$
  2509. 2    ASK@2, 12"Enter a text string"; x$
  2510. 3    ASK@2, 14"Enter a 3 character word"&3; x$
  2511. 4    ASK"Enter data-Customer Code"&8Cuscode.custfile
  2512. 5    ASK"Enter a number"; n%
  2513.  
  2514. ATN
  2515. PURPOSE
  2516. Calculates an angle whose tangent is known. The result is given in radians.
  2517.  
  2518. SYNTAX
  2519. ATN (nexpr)
  2520.  
  2521.                 5-20
  2522.  
  2523. COMMENTS
  2524.  
  2525. This function works out the angle from the angle's tangent given in nexpr.
  2526. For example: TAN (0.7854) is 1.0, so ATN (1.00) returns 0.7854 rads (which
  2527. is 45 degrees). To convert radians to degrees multiply by PI/180.
  2528.  
  2529. ATN is the complementary function of TAN.
  2530.  
  2531. EXAMPLES 
  2532.  
  2533. 1    numfieldc=ATN (numfielda)
  2534. 2    x%=ATN (y%)
  2535. 3    x%=ATN (VAL (x$))
  2536. 4    ?ATN (x%)
  2537.  
  2538. BEFORE GROUP
  2539. PURPOSE
  2540. Set before group activity with reports.
  2541.  
  2542. SYNTAX
  2543. BEFORE GROUP fieldname
  2544.  
  2545. COMMENTS
  2546.  
  2547. BEFORE GROUP is used in a Report Program to mark the start of a BEFORE
  2548. GROUP section.fieldname identifies the group, and must be the name of a
  2549. field which has previously been defined as a group-in the Forms Editor, you
  2550. define a group in the SELECT box; Superbase then translates this into a
  2551. GROUP statement in a Report program.
  2552.  
  2553. The statements in the BEFORE GROUP section ar executed every time the group
  2554. changes. Typically, they would be used to display header information for
  2555. the group data which follows.
  2556.  
  2557. A BEFORE GROUP section must end with an END GROUP statement.
  2558.  
  2559.                 5-21
  2560.  
  2561. EXAMPLES
  2562.  
  2563. 1    BEFORE GROUP Lastname.Clients
  2564.     ? "Deposits for client", Lastname.Clients
  2565.     ?
  2566.     ?"Firstname Lastname Bank Amount Date"
  2567.     "--------------------------------------"
  2568.     END GROUP
  2569.  
  2570. BELL
  2571. PURPOSE
  2572. Makes a short beep.
  2573.  
  2574. SYNTAX
  2575. BELL
  2576.  
  2577. COMMENTS
  2578.  
  2579. Use this command to signal that a particular process has finished and to
  2580. attract the user's attention.
  2581.  
  2582. With Gem versions of DML, BELL issues a tone lasting 0.5 seconds. On the
  2583. Amiga, BELL does not make a sound but causes the screen to flash.
  2584.  
  2585. BLANK
  2586. PURPOSE
  2587. Creates a blank record in memory.
  2588.  
  2589. SYNTAX
  2590. BLANK[FILE sbfname]
  2591.  
  2592. COMMENTS
  2593.  
  2594. When you want to create a new record under program control, issuing a BLANK
  2595. statement is the first step in the process. It sets up an empty record
  2596. record ready for data entry. There are several ways in which you can then
  2597. enter data into the record's fields.
  2598.  
  2599. Using BLANK with ENTER, allows the user to type in the data for a new
  2600. record
  2601.  
  2602.                 5-22
  2603.  
  2604. from the keyboard. Together these two commands have the same effect as the
  2605. RECORD NEW option in the RECORD menu.
  2606.  
  2607. Alternatively, you can enter data from within a program, by assigning it
  2608. directly to the fields in the new record. Typically, this would be the
  2609. method you used to create new records by reading data in from another file
  2610. on disk.
  2611.  
  2612. EXAMPLES
  2613.  
  2614. 1    BLANK
  2615. 2    BLANK FILE"abc"
  2616. 3    BLANK
  2617.     ENTER
  2618.     STORE
  2619. 4    BLANK
  2620.     Firstname.address="John"
  2621.     Lastname.address="Smith"
  2622.     STORE
  2623.  
  2624. The first example creates a new record in the current file. Example 2
  2625. creates a new record in another open file. Example 3 creates a new record
  2626. in the current file, and allows the user to enter in the record; then it
  2627. saves the record on disk. Example 4 creates a new record, and enters data
  2628. into the fields Firstname and Lastname; then saves the record on disk.
  2629.  
  2630. BREAK
  2631. PURPOSE
  2632.  
  2633. Allows the user to interrupt or halt a program from the keyboard.
  2634.  
  2635. SYNTAX
  2636. BREAK ON/OFF
  2637.  
  2638. COMMENTS
  2639.  
  2640. BREAK ON and BREAK OFF enable and disable CTRL C. After BREAK ON (the
  2641. default condition), you can stop a program while it is running by pressing
  2642. the Control key and C at the same time. This has the same effect as
  2643. clicking on the STOP button at the bottom of the screen. CTRL C generates
  2644. error 11. If you want to include error handling routines in your programs,
  2645. you can use the ON ERROR statement to check for this error number.
  2646.  
  2647.                 5-23
  2648.  
  2649. CALL
  2650. PURPOSE
  2651. Calls a user supplied function.
  2652.  
  2653. SYNTAX
  2654. CALL function
  2655.  
  2656. COMMENTS
  2657.  
  2658. function is string expression containing a command line to be executed by
  2659. DOS or Amiga DOS. The expression should duplicate a command line that would
  2660. normally be typed at the DOS or CLI prompt. Superbase stays in memory so
  2661. there must be enough memory for the specified command to function
  2662. correctly.
  2663.  
  2664. CHAIN
  2665. PURPOSE
  2666.  
  2667. Executes another program from within a program but does not clear the first
  2668. program's variables.
  2669.  
  2670. SYNTAX
  2671.  
  2672. CHAIN filename
  2673.  
  2674. COMMENTS
  2675.  
  2676. CHAIN allows you to carry out a task by linking together a number of
  2677. programs. When a program is running, this command loads another program
  2678. from disk, and transfers control to it. The second program displaces the
  2679. first in memory but any variables that have already been set retain their
  2680. values.
  2681.  
  2682. EXAMPLES
  2683.  
  2684. 1    CHAIN "Nextprog"
  2685.  
  2686.                 5-24
  2687.  
  2688. CHR$
  2689.  
  2690. PURPOSE
  2691. Generates the character associated with an ASCII code.
  2692.  
  2693. SYNTAX
  2694. CHR$ (nexpr)
  2695.  
  2696. COMMENTS
  2697.  
  2698. CHR$ works in the opposite way to ASC. Whereas ASC takes a character and
  2699. returns its ASCII code, CHR$ generates the character from its associated
  2700. code. It is useful for handling characters which are not available from the
  2701. keyboard, such as certain characters used to control a printer.
  2702.  
  2703. nexpr must have a positive value in the range 0-255 (although not all these
  2704. values will give printable characters). A value outside this range will
  2705. give the error 'Invalid numeric parameter'. If nexpr is not an integer, the
  2706. integer part of the number is used, i.e., 65.999 is treated as 65.
  2707.  
  2708. EXAMPLES
  2709.  
  2710. 1    textfieldc=CHR$ (numfielda)
  2711. 2    textfieldc=CHR$ (INT (numfielda/256))
  2712. 3    x$=CHR$ (65)
  2713. 4    x$=CHR$ (ASC (y$)+32)
  2714. 5    FOR n%=32 to 127
  2715.     ? CHR$ (n%); 
  2716.     Next
  2717.  
  2718. NOTES
  2719.  
  2720. Example 3 stores the letter A in x$. Example 4 demonstrates one way of
  2721. turning an uppercase character into lowercase - but see LCASE$ and FCASE$.
  2722. Example 5 displays the character set on the screen. Note that it does not
  2723. display characters are non-printing characters, and some of them have
  2724. unexpected effects when you attempt to display or print them.
  2725.  
  2726.                 5-25
  2727.  
  2728. CLEAR
  2729. PURPOSE
  2730. Clears all user variables.
  2731.  
  2732. SYNTAX
  2733. CLEAR
  2734.  
  2735. COMMENTS
  2736.  
  2737. This command clears all variable assignments in memory. Using ? MEMORY
  2738. immediately after CLEAR would give no output.
  2739.  
  2740. CLOSE
  2741. PURPOSE
  2742.  
  2743. Closes an input or output channel to a text file or comms line.
  2744.  
  2745. SYNTAX
  2746. CLOSE INPUT/OUTPUT
  2747.  
  2748. COMMENTS
  2749.  
  2750. Only one input channel and one output channel can be open at a time, so you
  2751. are advised to use the CLOSE command when you have completed an I/O task.
  2752. Unless you close the current channel you will not be able to open a new
  2753. channel. CLOSE also ensure that all data in the disk buffer is written to
  2754. disk. If you have a large disk buffer and a small amount of data, you will
  2755. notice that some output commands-? LIST, for example-appear to have no
  2756. effect. What happens is that DML places the data in the buffer before
  2757. writing it to disk. It remains there until the buffer fills up-or until you
  2758. execute a CLOSE OUTPUT command. Associated commands are OPEN and INPUT.
  2759.  
  2760.                 5-26
  2761.  
  2762. EXAMPLES
  2763.  
  2764. 1    OPEN FILE "aaa" FOR OUTPUT
  2765.     FOR i%=1 to 10: ? i%, i%^2: NEXT i%
  2766.     CLOSE OUTPUT
  2767.     OPEN FILE "aaa" FOR INPUT
  2768.     getnext: INPUT LINE a$: ? a$
  2769.     IF EOF ("*") THEN GOTO getnext
  2770.     CLOSE INPUT
  2771.  
  2772. CLOSE FIELDS
  2773. PURPOSE
  2774. Closes the field list on the current file or another open file.
  2775.  
  2776. SYNTAX
  2777. CLOSE FIELDS[FILE sbfname]
  2778.  
  2779. COMMENTS
  2780.  
  2781. CLOSE FIELDS removes any restrictions on which fields are shown. If you
  2782. VIEW a record after issuing this command, all its fields will be displayed
  2783. on screen. On its own, CLOSE FIELDS closes the field list for the current
  2784. file. When FILE sbfname is added, it closes the list for that file.
  2785.  
  2786. EXAMPLES
  2787.  
  2788. 1    CLOSE FIELDS
  2789. Close field list on current file.
  2790. 2    CLOSE FIELDS FILE "abc"
  2791. Close field list for file 'abc'.
  2792.  
  2793.                 5-27
  2794.  
  2795. CLOSE FILE
  2796. PURPOSE
  2797. Closes all files or a specified file.
  2798.  
  2799. SYNTAX
  2800. CLOSE[ALL]/[FILE sbfname]
  2801.  
  2802. COMMENTS
  2803.  
  2804. CLOSE FILE works in the same way as the equivalent option in the PROJECT
  2805. menu,  but unlike the menu option it also allows you to close all the open
  2806. files in one go.
  2807.  
  2808. EXAMPLES
  2809.  
  2810. 1    CLOSE
  2811. Closes the current file.
  2812. 2    CLOSE FILE "aaa"
  2813. Closes the database file 'aaa'.
  2814. 3    CLOSE ALL
  2815. Closes all open database files.
  2816.  
  2817. CLOSE FORM
  2818. PURPOSE
  2819. Closes the current Form
  2820.  
  2821. SYNTAX
  2822. CLOSE FORM
  2823.  
  2824. COMMENTS
  2825.  
  2826. This command works in the same way as the Close Form option on the Project
  2827. Menu: it clears the current Form from memory and displays the current file
  2828. using one of the view modes.
  2829.  
  2830.                 5-28
  2831.  
  2832. CLS
  2833. PURPOSE
  2834. Clears the screen.
  2835.  
  2836. SYNTAX
  2837. CLS
  2838.  
  2839. COMMENTS
  2840.  
  2841. CLS makes the output part of the screen-the output window-blank and takes
  2842. the cursor to the top left-hand corner.
  2843.  
  2844. EXAMPLES
  2845.  
  2846. 1    CLS: ? "Now at top of cleared screen"
  2847.  
  2848. COL
  2849. PURPOSE
  2850. Returns the cursor's position across the screen.
  2851.  
  2852. SYNTAX
  2853. COL (0)
  2854.  
  2855. COMMENTS
  2856.  
  2857. Use this command to find out the column position of the screen cursor. For
  2858. the row position, see ROW
  2859.  
  2860. EXAMPLES
  2861.  
  2862. 1    x%=COL (0)
  2863. 2    ? COL (0)
  2864.  
  2865. NOTES
  2866.  
  2867. In practise, Example 2 would be pointless because the statement changes the
  2868. cursor position in the course of printing it.
  2869.  
  2870.                 5-29
  2871.  
  2872. COPY
  2873. PURPOSE
  2874. Makes a copy of a file on disk.
  2875.  
  2876. SYNTAX
  2877. COPY from.filename[, ]/[TO]to.filename
  2878.  
  2879. COMMENTS
  2880.  
  2881. Use this command either to copy a file to the same disk under a different
  2882. name, or to copy it to another disk. In the latter case, you can give the
  2883. file the same name or a new name.
  2884.  
  2885. EXAMPLES
  2886.  
  2887. 1    COPY "aaa", "bbb"
  2888. Copies 'aaa' to 'bbb'.
  2889. 2    COPY "A: aaa" TO "B: bbb"
  2890. Copies 'aaa' to drive B under the name 'bbb'.
  2891.  
  2892. COS
  2893. PURPOSE
  2894. Returns the cosine of an angle measured in radians.
  2895.  
  2896. SYNTAX
  2897. COS (nexpr)
  2898.  
  2899. COMMENTS
  2900.  
  2901. To convert an angle in degrees to radians, multiply by PI/180. Associated
  2902. functions are ATN, SIN and TAN.
  2903.  
  2904. EXAMPLES
  2905.  
  2906. 1    numfieldc=COS (numfielda)
  2907. 2    x%=COS (y%)
  2908.  
  2909.                 5-30
  2910.  
  2911. 2    x%=COS (VAL (x$))
  2912. 4    ? COS (x%)
  2913.  
  2914. CREATE
  2915. PURPOSE
  2916. Creates a new database file in memory.
  2917.  
  2918. SYNTAX
  2919. CREATE sbfname[: passwords]
  2920.  
  2921. COMMENTS
  2922.  
  2923. CREATE is only the first step in the process of building a new file. To
  2924. define the file and store it on disk you also need to use ADD and MAKE. The
  2925. whole process involves the following steps:
  2926.  
  2927. 1. CREATE sbfname
  2928. 2. ADD field
  2929. At this point the file is held in memory and you can check it with ? STATUS
  2930. sbfname.
  2931. 3. MAKE sbfname
  2932. Writes the file to disk.
  2933.  
  2934. EXAMPLES
  2935.  
  2936. 1    CREATE "Address"
  2937.     ADD "Recon; NUM CON IXU; 999999.; 0, 0", "SER (~Address~)"
  2938.     ADD "Title; TXT; 10; 1, 34"
  2939.     ADD "Firstname; TXT; 15; 3, 6"
  2940.     ADD "Lastname; TXT IXD; 20; 3, 34"
  2941.     ADD "Street; TXT; 30; 6, 6"
  2942.     ADD "City; TXT IXD; 15; 7, 6"
  2943.     ADD "Code; TXT; 12; 7, 31"
  2944.     ADD "Country; TEXT IXD; 15; 9, 6"
  2945.     MAKE "Address"
  2946.  
  2947.                 5-31
  2948.  
  2949. NOTES
  2950.  
  2951. This example shows how to set up a simple address file under program
  2952. control. The first ADD statement defines a numeric field which is
  2953. automatically assigned a record number by means of the SER function. Note
  2954. the use of the tilde character to enter the filename Address within
  2955. quotation marks. Following this,  the ADD statements define eight text
  2956. fields which will hold the name and address. Once you have defined the file
  2957. in this way, you could then enter its data under program control, using the
  2958. commands BLANK and STORE.
  2959.  
  2960. CREATE INDEX
  2961. PURPOSE
  2962. Creates a new index file.
  2963.  
  2964. SYNTAX
  2965. CREATE INDEX ON exp[FILE sbfname][TO index][UNIQUE]
  2966.  
  2967. COMMENTS
  2968.  
  2969. This command is the program equivalent of the New Index option on the
  2970. Project menu.
  2971.  
  2972. EXAMPLES
  2973.  
  2974. 1    CREATE INDEX ON aaa
  2975. 2    CREATE INDEX ON aaa.bbb UNIQUE
  2976. 'bbb' does not need to be the current file, but it must be open.
  2977.  
  2978.                 5-32
  2979.  
  2980. DATA
  2981. PURPOSE
  2982.  
  2983. Holds the data (numeric and string constants) that is accessed by a READ
  2984. statement.
  2985.  
  2986. SYNTAX
  2987. DATA constant[, constant][, ......]
  2988.  
  2989. COMMENTS
  2990.  
  2991. The values (constants) following a DATA statement must be separated by
  2992. commas and text constants must be in quotation marks.
  2993.  
  2994. Because commas are used to separate the constants in a DATA statement, they
  2995. cannot be included in a constant. If you need to insert a comma in your
  2996. DATA items, you can use CHR$ (44).
  2997.  
  2998. To insert quotation marks in a string constant, use CHR$ (34). Date values
  2999. which are to be read into date fields must be in the correct format (e.g.,
  3000. "ddmmyy" or "mmddyy") and should be enclosed in quotation marks.
  3001.  
  3002. If you intend to use the RESTORE statement, you need to place a label in
  3003. front of the DATA statement.
  3004.  
  3005. EXAMPLES
  3006.  
  3007. 1    DATA "abcde", 1.04, 2.46, "uvwxyz"
  3008.     data1: DATA 12.2, 12.4, 12.97, 13.4, 9.2, -1
  3009.  
  3010.                 5-33
  3011.  
  3012. DATE$
  3013. PURPOSE
  3014. Returns a string from a julian date number.
  3015.  
  3016. SYNTAX
  3017. DATE$ (nexpr[, format-string])
  3018.  
  3019. COMMENTS
  3020.  
  3021. This function expresses a date number as a text string showing the day,
  3022. month and year. The format-string option is used to specify the date format
  3023. for the text string. It must be a valid Superbase format as shown in the
  3024. entry for DATEBASE.
  3025.  
  3026. If the format is given, the text string takes the date format as set with
  3027. the Date Format option on the Set menu, or as specified with the DATEBASE
  3028. command. The complementary function to DATE$ is DAYS. Associated date
  3029. functions are DAY DAYS DAY$ MONTH MONTH$ YEAR.
  3030.  
  3031. EXAMPLES
  3032.  
  3033. 1    textfieldc=DATE$ (datefielda, "ddmmyy")
  3034. 2    textfieldc=DATE$ (datefielda + 90)
  3035. 3    textfieldc=DATE$ (TODAY)
  3036. 4    x$=DATE$ (y%)
  3037. 5    ? DATE$ (datefielda + 30)
  3038.  
  3039. NOTES
  3040.  
  3041. Example 3 provides a calculation to insert the system date into a
  3042. textfield. Example 2 gives the date 90 days after the date in datefielda.
  3043. The Calendar adjustment of 1752 has been accounted for.
  3044.  
  3045. Unless you are sure that the date supplied in nexpr will always fall within
  3046. this century, you should set the date format to allow four figures for the
  3047. year; otherwise you will not be able to distinguish between 1901 and 2001.
  3048. With dates before AD 1000, the four figure year default option does not
  3049. insert
  3050.  
  3051.                 5-34
  3052.  
  3053. zeroes. AD 55, for example, is shown as 55 and not 0055. If you wish to
  3054. have four figure years-say, to line up output-add 3653048 to nexpr. As well
  3055. as ensuring that the date is always expressed as four figures, this is the
  3056. only way to access AD 0. However, early calendars were not particularly
  3057. accurate and accurate day counts between two dates cannot be relied on with
  3058. dates before AD 1400. (Superbase always gives the same answer; history,
  3059. though, is less consistent).
  3060.  
  3061. DATEBASE
  3062. PURPOSE
  3063. Sets the DATE format and TIME format.
  3064.  
  3065. SYNTAX
  3066. DATEBASE string
  3067.  
  3068. COMMENTS
  3069.  
  3070. DATEBASE allows you to specify the format with which Superbase displays the
  3071. date and time. Normally, this format only applies when you use the system
  3072. variables, TODAY and NOW. It does not affect the format of date and time
  3073. fields,  as set in the file definition. This means that if you define a
  3074. date field with the format "dd-mmm-yy", the command
  3075.  
  3076.     ? datefield
  3077.  
  3078. will display it in this format, irrespective of what the DATEBASE format
  3079. is. However, you can force Superbase to display a date field in the current
  3080. date format by enclosing the field name in parentheses, as in:
  3081.  
  3082.     ? (datefield)
  3083.  
  3084. string must have a valid date or time format, as shown in the examples
  3085. below.
  3086.  
  3087. EXAMPLES
  3088.  
  3089. 1    DATEBASE "dd mmmm, yyyy"
  3090. Displays the date like this as 10 June 1987
  3091. 2    DATEBASE "dd/mm/yy"
  3092. Display the date as 10/6/87
  3093.  
  3094.                 5-35
  3095.  
  3096. 3    DATEBASE "mm-dd-yy"
  3097. Displays the date as 6-10-87
  3098. 4    DATEBASE "dd.mm.yy"
  3099. Displays the date as 6.10.87
  3100. 5    DATEBASE "dd mm yy"
  3101. Displays the date as 6 10 87
  3102. 6    DATEBASE "hh:mm"
  3103. Displays the time as 14:35
  3104. 7    DATEBASE "hh:mm:ss"
  3105. Displays the timeas 14:35:08
  3106. 8    DATEBASE "hh:mm:ss.s"
  3107. Displays the time as 14:35:08.36
  3108. 9    DATEBASE "hh:mm am"
  3109. Displays the time as 2:35 pm
  3110.  
  3111. DAY
  3112. PURPOSE
  3113.  
  3114. Returns the day of the month as a numeric value from a date field or a date
  3115. string.
  3116.  
  3117. SYNTAX
  3118. DAY (nexpr)
  3119.  
  3120. COMMENTS
  3121.  
  3122. The number which DAY returns takes the numeric format as set in the SET-
  3123. NUMERIC FORMAT Superbase menu, or as set with the command DATEBASE.
  3124. Associated date functions are DATE$ DAY DAY$ MONTH MONTH$ YEAR.
  3125.  
  3126. EXAMPLES
  3127.  
  3128. 1    numfieldc=DAY (datefielda)
  3129.  
  3130.                 5-36
  3131.  
  3132. 2    numfieldc=DAY (datefielda + 90)
  3133. 3    numfieldc=DAY (TODAY)
  3134. 4    x%=DAY (datefielda + VAL (textfielda))
  3135. 5    x%=DAY (DAYS ("11 Jan 85")
  3136. 6    ?DAY (datefielda + 30)
  3137.  
  3138. NOTES
  3139.  
  3140. Examples 3 provides a calculation to insert the day number of the system
  3141. date into a numeric field.
  3142.  
  3143. DAY$
  3144. PURPOSE
  3145. Returns the day of the week as a text string from a julian date number.
  3146.  
  3147. SYNTAX
  3148. DAY$ (nexpr)
  3149.  
  3150. COMMENTS
  3151.  
  3152. Associated date functions are DATE$ DAY DAY$ MONTH MONTH$ YEAR.
  3153.  
  3154. EXAMPLES
  3155.  
  3156. 1    textfieldc=DAY$ (datefielda)
  3157. 2    textfieldc=DAY$ (datefileda + 90)
  3158. 3    textfieldc=DAY$ (TODAY)
  3159. 4    x$=DAY$ (DAYS ("11 January 1985"))
  3160. 5    x$=DAYS (y%)
  3161. 6    ?DAYS (datefielda + 30)
  3162.  
  3163.                 5-37
  3164.  
  3165. NOTES
  3166.  
  3167. Example 3 provides a calculation to insert the weekday of the system date
  3168. into a textfield. Example 4 provides a weekday for the date shown in
  3169. quotation marks.
  3170.  
  3171. DAYS
  3172. PURPOSE
  3173.  
  3174. Returns the date as a julian date number from a text string or text field.
  3175.  
  3176. SYNTAX
  3177. DAYS (strexpr) or DAYS (nexpr)
  3178.  
  3179. COMMENTS
  3180.  
  3181. This function returns a number which is the julian day number of the date
  3182. in strexpr (31 December AD 0 has a julian date value of zero). It takes the
  3183. 1752 Gregorian reform of the calendar into account.
  3184.  
  3185. strexpr must be in a valid date format.
  3186.  
  3187. A text expression which is not in one of the valid date formats will
  3188. produce a message 'invalid date format'.
  3189.  
  3190. Associated date functions are: DATE$ DAY DAY$ MONTH MONTH$ YEAR.
  3191.  
  3192. EXAMPLES
  3193.  
  3194. 1    numfieldc=DAYS (textfielda)
  3195. 2    numfieldc=DAYS (datefielda + 90)
  3196. 3    numfieldc=DAYS ("11 jan 85")
  3197. 4    x%=DAYS (a$) + 90
  3198.  
  3199. NOTES
  3200.  
  3201. In example 2, the use of DAYS is redundant.
  3202.  
  3203.                 5-38
  3204.  
  3205. DELETE
  3206. PURPOSE
  3207. Deletes a file stored on disk.
  3208.  
  3209. SYNTAX
  3210. DELETE filename
  3211.  
  3212. COMMENTS
  3213.  
  3214. This command has the same effect as the ERASE command in MS DOS and DELETE
  3215. in Amiga DOS. To delete a file on a drive or directory other than the
  3216. current one,  you need to place the path name in front of the file name.
  3217.  
  3218. EXAMPLES
  3219.  
  3220. 1    DELETE "aaa"
  3221. 2    DELETE "b: aaa"
  3222. 3    DELETE "DF0: aaa"
  3223.  
  3224. DIM
  3225. PURPOSE
  3226. Defines array variables
  3227.  
  3228. SYNTAX
  3229. DIM variablename (nexpr[, nexpr][, nexpr])
  3230.  
  3231. COMMENTS
  3232.  
  3233. Arrays can have up to three dimensions. nexpr specifies the number of
  3234. elements in each dimension of an array. The maximum number of elements is
  3235. limited only by the amount of available memory.
  3236.  
  3237. A single DIM statement can be used to define more than one array. If DIM is
  3238. used in this way, each array definiton should be separated by commas. Note
  3239. that the first element in an array dimension has the subscript 0.
  3240.  
  3241.                 5-39
  3242.  
  3243. EXAMPLES
  3244.  
  3245. 1    DIM x% (20)
  3246. Defines a one dimensional numeric array with 21 elements.
  3247. 2    DIM b$ (10)
  3248. 3    DIM x% (3, 10)
  3249. 4    DIM b$ (2, 12)
  3250. 5    DIM a$ (20), n% (2, 3, 10), c$ (2, 10)
  3251.  
  3252. DIRECTORY
  3253. PURPOSE
  3254. Changes the current directory.
  3255.  
  3256. SYNTAX
  3257. DIRECTORY "path"
  3258.  
  3259. COMMENTS
  3260.  
  3261. Directory can be used to switch to a directory on another drive or to a
  3262. different directory in the same drive.
  3263.  
  3264. EXAMPLES
  3265.  
  3266. 1    DIRECTORY "dh0: mydir/testdir"
  3267. 2    x$="a: ": DIRECTORY x$
  3268. 3    C: /Images
  3269.  
  3270.                 5-40
  3271.  
  3272. DISKSPACE
  3273. PURPOSE
  3274. Shows the amount of space remaining on a disk.
  3275.  
  3276. SYNTAX
  3277. DISKSPACE (strexpr)
  3278.  
  3279. COMMENTS
  3280.  
  3281. This function gives the number of unused bytes on a disk. On the Amiga, the
  3282. disk name given in strexpr can be either a drive name or a volume name
  3283. (i.e.,  a diskname such as Mydisk: ). Gem systems only support drive names.
  3284. On the Amiga, the diskname must end in a colon. Note also that the free
  3285. block given by the CLI are 488 byte blocks.
  3286.  
  3287. EXAMPLES
  3288.  
  3289. 1    Diskspace "df0:"
  3290. 2    DISKSPACE ("Mydisk:")
  3291. 3    x$="df1:":x%=DISKSPACE (x$)
  3292. 4    ? "Remaining diskspace is: ";  DISKSPACE ("a:"); "bytes"
  3293.  
  3294.                 5-41
  3295.  
  3296. EDIT
  3297. PURPOSE
  3298. Allows the user to edit a program, a text file, a Query, or an Update.
  3299.  
  3300. SYNTAX
  3301. EDIT [TEXT]/[QUERY]/[UPDATE]
  3302.  
  3303. COMMENTS
  3304.  
  3305. Depending on which option has been selected, EDIT displays a window or a
  3306. dialog. EDIT QUERY displays the query dialog. EDIT UPDATE displays the
  3307. update filter dialog. EDIT TEXT opens the text editor window. If none of
  3308. the three options has been selected, EDIT opens the program window. After
  3309. EDIT has opened a window or dialog, you can edit the information, just as
  3310. you would if you had selected one of the Edit options from the Superbase
  3311. menus for example, Edit Program from the Advanced menu, or Edit Query from
  3312. the Process menu. The difference is that when you exit from the window or
  3313. dialog, control returns to the program.
  3314.  
  3315. To exit from a window, close the window by clicking on the close gadget in
  3316. the top left-hand corner. You exit from a dialog by clicking on OK or
  3317. Cancel. In Superbase itself, clicking on OK takes the user out of the
  3318. dialog, and then runs the query or update; clicking on OK after EDIT returns
  3319. control to the program without executing a query or an update. (To run a
  3320. query, use ? QUERY, and use UPDATE to carry out an update.)
  3321.  
  3322.                 5-42
  3323.  
  3324. EJECT
  3325. PURPOSE
  3326.  
  3327. Ejects the current page on the printer or feeds in a new page when the
  3328. number of lines remaining is less than the number specified.
  3329.  
  3330. SYNTAX
  3331. EJECT[nexp]
  3332.  
  3333. COMMENTS
  3334.  
  3335. EJECT on its own has the same effect as pressing the Form Feed button on
  3336. the printer. It sends a Form Feed character to the printer, which then
  3337. moves the current page on and feeds in the next. If nexp is used, the page
  3338. is ejected when the number of lines at the bottom of the page is less than
  3339. nexp.
  3340.  
  3341. EXAMPLES
  3342.  
  3343. 1    EJECT
  3344. 2    EJECT 3
  3345. Feeds in a new page if there are less than three lines left at the bottom
  3346. of the current page.
  3347.  
  3348.                 5-43
  3349.  
  3350. END
  3351. PURPOSE
  3352. Terminates program execution.
  3353.  
  3354. SYNTAX
  3355. END
  3356.  
  3357. COMMENTS
  3358.  
  3359. This command brings a program to a halt and returns control to the
  3360. Superbase Menu system. END is optional and if you do not include it, DML
  3361. will return control to Superbase when it reaches the last statement in a
  3362. program.
  3363.  
  3364. EXAMPLES
  3365.  
  3366. 1    IF EOF ("aaa") THEN END
  3367.  
  3368. END GROUP
  3369. SYNTAX
  3370. END GROUP
  3371.  
  3372. PURPOSE
  3373. Marks the end of a BEFORE GROUP or AFTER GROUP section.
  3374.  
  3375. COMMENTS
  3376.  
  3377. A BEFORE GROUP or AFTER GROUP section in a Report program must end with an
  3378. END GROUP statement. If it doesn't, Superbase will be unable to tell which
  3379. statements below to which section.
  3380.  
  3381.                 5-44
  3382.  
  3383. END HEADING
  3384. PURPOSE
  3385. Marks the end of a HEADING section in a Report program.
  3386.  
  3387. SYNTAX
  3388. END HEADING
  3389.  
  3390. COMMENTS
  3391.  
  3392. A HEADING section defines the headings for a report. It must start with the
  3393. keyword HEADING, followed by one or more '?' statements which specify the
  3394. heading information. END HEADING must be placed at the end of the section.
  3395.  
  3396. END REPORT
  3397. PURPOSE
  3398. Marks the end of an AFTER REPORT or BEFORE REPORT section.
  3399.  
  3400. SYNTAX
  3401. END REPORT
  3402.  
  3403. COMMENTS
  3404.  
  3405. END REPORT must be placed at the end of the set of statements that
  3406. constitute an AFTER REPORT or BEFORE REPORT section in a Report program.
  3407. Superbase automatically generates END REPORT statements at the end of these
  3408. sections when you create a report using the Forms Editor's reporting
  3409. facility.
  3410.  
  3411.                 5-45
  3412.  
  3413. ENTER
  3414. PURPOSE
  3415.  
  3416. Allows the user to enter data in the current file or to edit the data in a
  3417. record.
  3418.  
  3419. SYNTAX
  3420. ENTER[field]/[nexpr][, nexpr2]
  3421.  
  3422. COMMENTS
  3423.  
  3424. ENTER works on the current file. Used on its own, it is equivalent to the
  3425. Record menu option Edit. It displays the current record and allows you to
  3426. edit it field by field, starting with the first field. In effect, ENTER
  3427. temporarily hands over control from DML to Superbase itself. When you press
  3428. Return after the last field in a record or when you move the cursor down to
  3429. the bottom of the record,  control is transferred back to DML. If field or
  3430. nexpr is used, Superbase restricts the editing to just one field. You can
  3431. supply either a field name or a field number where the number corresponds
  3432. to the field's position in the field list; i.e., if there are six fields in
  3433. a record, the number for the first field is 1 and the number for the last
  3434. field in 6. When you enter the record, Superbase makes the editing cursor
  3435. active in the field specified and transfers control back to DML when you
  3436. press Return. With the second numeric parameter, nexpr2, you can specify
  3437. that a range of fields is available for editing, field or nexpr1 gives the
  3438. starting point, nexpr2 gives the number of fields that can be edited - from
  3439. the first field after field on nexpr1 onwards. For example, if the command
  3440. was:
  3441.  
  3442.     ENTER 3, 5
  3443.  
  3444. you would be able to edit fields 3 to 8.
  3445.  
  3446. You may want to specify a starting point without restricting the yourself
  3447. to a given number of fields. To do this, enter 0 as the second numeric
  3448. parameter; e.g.:
  3449.  
  3450.     ENTER Lastname, 3
  3451.  
  3452. would make the cursor active in Lastname and would allow you to edit
  3453.  
  3454.                 5-46
  3455.  
  3456. Lastname and the next three fields.
  3457.  
  3458. ENTER works with the current view mode or Form. Note that if you have set
  3459. the Field Order on the Form, Superbase will take the first record (in the
  3460. order you have specified) as the starting point for data entry and editing.
  3461. When used in conjunction with BLANK, ENTER is equivalent to the Record menu
  3462. option New, and allows you to enter data into a new record. This command
  3463. does not save a record; to save a new or edited record use the command
  3464. STORE.
  3465.  
  3466. EXAMPLES
  3467.  
  3468. 1    OPEN FILE "aaa"
  3469.     ASK "Record to edit"; x$
  3470.     SELECT KEY x$
  3471.     ENTER
  3472.     STORE
  3473. 2    OPEN FILE "aaa"
  3474.     BLANK
  3475.     ENTER
  3476.     STORE
  3477. 3    ENTER Lastname
  3478. 4    ENTER 4, 2
  3479.  
  3480. Example 1 shows how to enter an existing record in order to edit it.
  3481. Example 2 creates a new record. Example 3 restricts editing to the Lastname
  3482. field. In the last example, fields 4 to 6 can be edited.
  3483.  
  3484.                 5-47
  3485.  
  3486. EOF
  3487. PURPOSE
  3488.  
  3489. Detects the end of a database file when reading through it under program
  3490. control.
  3491.  
  3492. SYNTAX
  3493. EOF (strexpr)
  3494.  
  3495. COMMENTS
  3496.  
  3497. strexpr should contain the name of a currently open file. If DML reaches
  3498. the end of a file, EOF is set to -1 (true); otherwise it is set to 0
  3499. (false). EOF is only used under program control. Supplying the empty string
  3500. as an argument-EOF ("") -allows you to refer to the current file without
  3501. giving the file name. For example, to define a function key which was
  3502. equivalent to the Fast Forward button, you would enter:
  3503.  
  3504.     WHILE NOT EOF (""): SELECT NEXT: VIEW: WEND
  3505.  
  3506. EOF can also be used to detect the end of a text file. For this purpose it
  3507. takes the string "*" as an argument, and not the file name; that is, EOF
  3508. ("*") is set to 'true' when the end of a text file is found. EOF is only
  3509. set and unset by the SELECT record selection commands excluding SELECT KEY
  3510. (which only set the FOUND function). In other words it is possible to
  3511. search through a file with a filter, and set EOF to 'true' by not finding a
  3512. record, and then to use the 'key-lookup' (SELECT KEY) to look for a record
  3513. outside the filter. If you do this, FOUND will reflect the success of the
  3514. 'key-lookup' operation, while EOF will show that you are at the end of the
  3515. file.
  3516.  
  3517. EXAMPLES
  3518.  
  3519. 1    ? EOF (x$)
  3520.     OPEN FILE "aaa"; SELECT FIRST:
  3521.     IF EOF ("aaa") THEN GOTO fempty
  3522.     loop1: SELECT NEXT: IF EOF ("aaa") THEN GOTO fend
  3523.     ....
  3524.     GOTO loop1
  3525.     fempty: ? "FILE 'aaa' has no records"; END
  3526.     fend: ? "Process completed"; END
  3527.  
  3528.                 5-48
  3529.  
  3530. ERASE
  3531. PURPOSE
  3532. Clears a variable assignment from memory.
  3533.  
  3534. SYNTAX
  3535. ERASE varlist
  3536.  
  3537. COMMENTS
  3538.  
  3539. This command clears a variable or a list of variables from memory. If
  3540. several variables are to be cleared, varlist should contain a list of
  3541. variable names separated by commas. If you specify the name of an array,
  3542. ERASE clears all the elements in the array (it also clears any other
  3543. variable with the same name as the array).
  3544.  
  3545. EXAMPLES
  3546.  
  3547. 1    ERASE x$
  3548. 2    ERASE a%, b%, c%, d%, a$, b$
  3549. 3    a$="Fred"
  3550.     a%=2.35
  3551.     MEMORY
  3552.     ERASE a$
  3553.     MEMORY
  3554.  
  3555. NOTES
  3556.  
  3557. The most obvious use for this command is to tidy up the variables in memory
  3558. before CHAINing another program or before OUTPUT TO "aaa" MEMORY. You could
  3559. then use SET "aaa" to pass some values to variables in the new program.
  3560.  
  3561.                 5-49
  3562.  
  3563. ERR$
  3564. PURPOSE
  3565. Returns the text message associated with an error number.
  3566.  
  3567. SYNTAX
  3568. ERR$ (nexpr)
  3569.  
  3570. COMMENTS
  3571.  
  3572. This function returns a text string containing the error message associated
  3573. with the error number given in nexpr. Use this function in conjunction with
  3574. the control flow commands ON ERROR and RESUME, and the system variable
  3575. ERRNO.
  3576.  
  3577. EXAMPLES
  3578.  
  3579. 1    ? ERR$ (ERRNO)
  3580.     CLS: NUMBASE "z9999"
  3581.     FOR i%=1 to 130
  3582.     ? "Error number"; i%, " "; ERR$ (i%)
  3583.     NEXT i%
  3584. 3    x$=ERR$ (14)
  3585.  
  3586. Example 2 displays a list of error numbers with their associated error
  3587. messages.
  3588.  
  3589. ERRNO
  3590. PURPOSE
  3591. Returns the number of the last error that occurred.
  3592.  
  3593. SYNTAX
  3594. ERRNO
  3595.  
  3596. COMMENTS
  3597.  
  3598. ERRNO is used in conjunction with the error handling commands ON ERROR and
  3599. RESUME and with the function ERR$ which gives the error message associated
  3600. with
  3601.  
  3602.                 5-50
  3603.  
  3604. an error number.
  3605.  
  3606. EXAMPLES
  3607.  
  3608. 1    x%=ERRNO
  3609. 2    ? ERR$ (ERRNO)
  3610.  
  3611. NOTES
  3612. Example 2 displays the error message associated with the last error which
  3613. occurred.
  3614.  
  3615. EXECUTE
  3616. PURPOSE
  3617. Executes a text string as though it were a command.
  3618.  
  3619. SYNTAX
  3620. EXECUTE string
  3621.  
  3622. COMMENTS
  3623.  
  3624. Any set of commands, statements, and functions that can be carried out as a
  3625. single program line can be placed in a string and then executed.
  3626.  
  3627. EXAMPLES
  3628.  
  3629. 1    EXECUTE "SELECT CURRENT: VIEW: WAIT FOR 5"
  3630.     y$="REQUEST ~ OK/CANCEL Requestor ~, ~~, 1"
  3631.     EXECUTE y$
  3632.  
  3633. NOTES
  3634.  
  3635. Example 2 suggests a way of using this function to set up a user-defined
  3636. dialog which can be called from different points in a program. Note the use
  3637. of the tilde character to embed quotation marks in a string.
  3638.  
  3639.                 5-51
  3640.  
  3641. EXP
  3642. PURPOSE
  3643. Returns the value of the mathematical constant 'e' raised to a power.
  3644.  
  3645. SYNTAX
  3646. EXP (nexpr)
  3647.  
  3648. COMMENTS
  3649.  
  3650. EXP gives the value of 'e' to the power of expr.
  3651. nexpr has a maximum absolute value of 709.7827128934, and a range of
  3652. -709.7827128934 to + 709.7827128934. This in turn gives the largest number
  3653. that Superbase can hold - 1.797693134862 times 10 to the power 308.
  3654.  
  3655. EXAMPLES
  3656.  
  3657. 1    numfieldc=EXP (numfielda)
  3658. 2    numfieldc=EXP (datefielda-datefield)
  3659. 3    numfieldc > EXP (numfielda & numfield)
  3660. 4    x%=EXP (y%)
  3661. 5    x%=EXP (y% * numfielda * (datefielda-datefield))
  3662. 6    x%=EXP (VAL (RIGHT$ (textfielda, 5)))
  3663. 7    ? EXP (x%)
  3664.  
  3665.                 5-52
  3666.  
  3667. EXPORT
  3668. PURPOSE
  3669. Exports data to an external text file from the current file.
  3670.  
  3671. SYNTAX
  3672. EXPORT[FILE sbfname[INDEXindex][TO]filename
  3673. [WHEREconditions] [USINGparams]
  3674.  
  3675. COMMENTS
  3676.  
  3677. This command is the program equivalent of the EXPORT option in the PROCESS
  3678. menu. It creates a text file on disk using the data from an sbf file. The
  3679. only compulsory parameter is filename, which gives the name of the text
  3680. file. If FILE sbfname is not specified, EXPORT takes data from the current
  3681. open file. Similarly, unless INDEX indexname is given, the command exports
  3682. records in the order of the current index. WHERE conditions allows you to
  3683. creates a filter to determine which records are copied to the text
  3684. file.conditions is set up in the same way as the command string in the
  3685. Filter requestor. USING parameters allows you to change the Export/Import
  3686. parameters as specified by SET-OPTIONS. These determine what characters
  3687. Superbase uses to separate fields and records in the text file. You can
  3688. also specify whether text fields are exported with or without quotation
  3689. marks around them. USING takes three parameters, each enclosed by quotation
  3690. marks and separated by commas. For example:
  3691.  
  3692.     USING "&", "$$", "0"
  3693.  
  3694. The first two parameters specify the field separation characters and the
  3695. record separation characters. As in SET-OPTIONS, you can define a separator
  3696. using one character or two characters. The third parameter must be either 0
  3697. or 1; 0 for no quotation marks,  1 to include quotation marks.
  3698.  
  3699.                 5-53
  3700.  
  3701. If you want to use a non-printing character-the carriage return character
  3702. or the line feed character, for example-as a separator, you need to enter
  3703. its ASCII code with the CHR$ function. For example:
  3704.  
  3705.     USING "&", CHR$ (13) + CHR$ (10), "0"
  3706.  
  3707. defines the record separator as the carriage return character followed by
  3708. the line feed character.
  3709.  
  3710. EXAMPLES
  3711.  
  3712. 1    EXPORT "aaa.exp"
  3713. 2    EXPORT FILE "aaa" INDEX fielda TO "aaa.exp" WHERE
  3714.     (datefield) < DAYS ("29 Apr 87")
  3715. 3    EXPORT FILE "aaa" TO "aaa.exp" USING "&", "##", "1"
  3716.  
  3717.                 5-54
  3718.  
  3719. FCASE$
  3720. PURPOSE
  3721. Converts the first letter of a string to upper case, leaving the rest of
  3722. the string in lower case.
  3723.  
  3724. SYNTAX
  3725. FCASE$ (strexpr)
  3726.  
  3727. COMMENTS
  3728.  
  3729. FCASE$ takes a word and makes the first letter a capital letter. Associated
  3730. functions are LCASE$ and UCASE$.
  3731.  
  3732. EXAMPLES
  3733.  
  3734. 1    textfielda=FCASE$ (textfielda)
  3735. 2    x$=FCASE$ (y$)
  3736. 3    x$=FCASE$ ("ABCDEF")
  3737. 4    ? FCASE$ (x$)
  3738.  
  3739.                 5-55
  3740.  
  3741. FILE
  3742. PURPOSE
  3743. Marks an open file the current file.
  3744.  
  3745. SYNTAX
  3746. FILE sbfnam
  3747.  
  3748. COMMENTS
  3749.  
  3750. When several files have been opened, you can use FILE to make one of them
  3751. the current file.
  3752.  
  3753. EXAMPLES
  3754.  
  3755. 1    FILE "aaa"
  3756. 2    x$="bbb": FILE x$
  3757. 3    a$="address": b$="bank"
  3758.     OPEN FILE a$: SELECT FIRST
  3759.     OPEN FILE b$: SELECT FIRST
  3760.     PAGING OFF
  3761.     f$=b$
  3762.     lab1: VIEW: WAIT x$
  3763.     IF EOF (a$) OR EOF (b$) THEN END
  3764.     IF f$=b$ THEN f$=a$ ELSE f$=b$
  3765.     FILE f$: SELECT NEXT
  3766.     GOTO lab1
  3767.  
  3768. NOTES
  3769.  
  3770. The third example shows how you can display records from two (or more)
  3771. files at the same time. It displays one record after another, alternating
  3772. between two files until it reaches the end of the shorter file.
  3773.  
  3774.                 5-56
  3775.  
  3776. FIX
  3777. PURPOSE
  3778.  
  3779. Sets the accuracy with which DML stores a number and performs calculations
  3780. on it.
  3781.  
  3782. SYNTAX
  3783. FIX (nexpr1, nexpr2)
  3784.  
  3785. COMMENTS
  3786.  
  3787. FIX allows you to limit a numeric expression to a specified number of
  3788. decimal places. nexpr2 is the number of decimal places that nexpr1 is
  3789. evaluated at. Superbase stores numeric variables at 13 figure accuracy, so
  3790. the fraction 1/3 is stored as 0.3333333333333. Adding two of these together
  3791. gives 0.6666666666667. If you set the numeric format to two decimal places
  3792. in a file definition,  Superbase would show this result as: 0.33 +
  3793. 0.33=0.67. This is not incorrect, especially if you are a scientist or
  3794. engineer, but it is not very helpful if you are using a Query to produce an
  3795. invoice. FIX (1/3, 2) stores the fraction 1/3 as 0.330000000000, so FIX
  3796. (1/3, 2) + FIX (1/3, 2) gives result as 0.66. Note that numeric fields with
  3797. two decimal places are automatically FIXed.
  3798.  
  3799. EXAMPLES
  3800.  
  3801. 1    numfieldc=FIX (numfielda, 3)
  3802. 2    numfieldc=FIX (datefielda-datefieldb, 0)
  3803. 3    numfieldc > FIX (numfielda * numfieldb, 4)
  3804. 4    $x=FIX ($y, 2)
  3805. 5    $x=FIX ($y * numfielda * (datefielda-datefieldb), 2)
  3806. 6    $x=FIX (VAL (RIGHT$ (textfielda, 5)), 2)
  3807. 7    ? FIX ($x)
  3808.  
  3809.                 5-57
  3810.  
  3811. FOOTING
  3812. PURPOSE
  3813. Sets the Report footing for every page.
  3814.  
  3815. SYNTAX
  3816. FOOTING nexpr
  3817.  
  3818. COMMENTS
  3819.  
  3820. FOOTING is followed by a number of ? statements specifying the information
  3821. that will appear at the bottom of every page in a report. These must be
  3822. followed by an END FOOTING statement. nexpr specifies the number of lines
  3823. required for the report footing. Make sure that the number of lines output
  3824. by your ? statements is the same as the number specified by nexpr.
  3825.  
  3826. EXAMPLES
  3827.  
  3828. 1    FOOTING 1
  3829.     ? "Page"; PG
  3830.     END FOOTING
  3831.  
  3832. NOTES
  3833. This examples uses the system variable PG to print the page number. See the
  3834. entry HEADING for more details.
  3835.  
  3836. FOR TO NEXT
  3837. PURPOSE
  3838. Repeats a series of program statements a specified number of times.
  3839.  
  3840. SYNTAX
  3841. FOR var=nexp1 TO nexp2[STEP nexp3]statements NEXT[var][, var]...
  3842.  
  3843. COMMENTS
  3844.  
  3845. This command sets up a program loop in which the statements between FOR TO
  3846. and NEXT are executed a given number of times, using var as a counter.
  3847. nexp1 sets the initial value of the counter and nexp2 sets the final value.
  3848.  
  3849.                 5-58
  3850.  
  3851. If STEP nexp3 is not included, the counter is increased by one every time
  3852. the program executes the statements inside the loop; that is, every time it
  3853. passes from FOR to NEXT. When the counter reaches the value set in nexp3,
  3854. the program moves on to the next statement after NEXT. When STEP nexp3 is
  3855. included, the program increases the counter by the amount specified in
  3856. nexp3. var must be a numeric variable; nexp1, nexp2, nexp3 can be any
  3857. numeric expression,  including other numeric variables. You can use FOR TO
  3858. NEXT on the same line with multiple statements, or on multiple lines. But
  3859. if there is more than one statement between FOR and NEXT, it is advisable
  3860. to put each on a separate line. If a number of FOR NEXT loops end at the
  3861. same point, you can use a single NEXT statement for all of them.
  3862.  
  3863.     NEXT n%, y%, z%
  3864.  
  3865. is the same as
  3866.  
  3867.     NEXT n%
  3868.     NEXT y%
  3869.     NEXT z%
  3870.  
  3871. EXAMPLES
  3872.  
  3873. 1    FOR i%=1 to 10: ? i%, i% ^ 2: NEXT
  3874. 2    weekcount%=1
  3875.     FOR i%=DAYS ("01/01/87") TO DAYS ("31/03/87") STEP 7
  3876.     FOR j%=0 to 6: k%=i% + j%
  3877.     ? DAY (k%); " "; MONTH$ (k%), DAY$ (k%)
  3878.     NEXT j%
  3879.     weekcount%=weekcount% + 1
  3880.     NEXT i%
  3881.  
  3882. Example 2 prints out the weekdays for the first quarter of 1987 in weeks.
  3883.  
  3884.                 5-59
  3885.  
  3886. FORM
  3887. PURPOSE
  3888. Specifies which part of a Form is displayed in the database window.
  3889.  
  3890. SYNTAX
  3891. FORM page[, row, col]
  3892.  
  3893. COMMENTS
  3894.  
  3895. This command is used to select a particular page within a multi-page form
  3896. or to bring part of a page that is outside the database window into view.
  3897. page must be a numeric expression specifying the page number.row and col
  3898. must be numeric expressions which give a row and column position within the
  3899. page. Form will then move the page so that the specified position is at the
  3900. top left-hand corner of the database window.
  3901.  
  3902. EXAMPLES
  3903.  
  3904. 1    FORM 2
  3905. Selects page 2 in the Form currently displayed.
  3906. 2    FORM 1, 24, 1
  3907. Makes row 24, column 1 of page 1 appear at the top left-hand corner of the
  3908. database window.
  3909.  
  3910. FOUND
  3911. PURPOSE
  3912. Detects whether a key lookup has been successful or not.
  3913.  
  3914. SYNTAX
  3915. FOUND (strexpr)
  3916.  
  3917. COMMENTS
  3918.  
  3919. After you have issued a SELECT KEY command to search for a particular
  3920. record,  FOUND will tell you whether the record has been found. If the
  3921. search is successful, FOUND returns a value of -1 (true); if the search is
  3922. unsuccessful, 
  3923.  
  3924.                 5-60
  3925.  
  3926. FOUND returns 0.
  3927. strexpr should contain the file name of '.sbf' file which has already been
  3928. opened. However, you can use the empty string-as in FOUND ("") -to refer to
  3929. the current file. FOUND is only set and cleared by the SELECT KEY and
  3930. LOOKUP commands.
  3931.  
  3932. EXAMPLES
  3933.  
  3934. 1    SELECT KEY "London"
  3935.     ? FOUND ("")
  3936. 2    a$="Clients": SELECT KEY "Smith" FILE a$
  3937.     IF FOUND (a$) THEN ? "Smith found" ELSE ? "No Smiths"
  3938.  
  3939. FREE
  3940. PURPOSE
  3941. Returns the amount of free memory.
  3942.  
  3943. SYNTAX
  3944. FREE (nexpr)
  3945.  
  3946. COMMENTS
  3947.  
  3948. This function returns a number showing how much free memory there is. On
  3949. the Amiga, nexpr determines whether the figure refers to chip, contiguous
  3950. or fast memory.
  3951.  
  3952. 0=total free memory
  3953. 2=chip memory
  3954. 4=fast memory
  3955.  
  3956. Adding 2^17 to one of these parameters gives the largest block of memory in
  3957. its respective memory area. So, 2^17 + 2 gives the maximum area of
  3958. contiguous chip memory.
  3959.  
  3960. EXAMPLES
  3961.  
  3962. 1    ? FREE (0)
  3963. 2    x%=FREE (i%)
  3964.  
  3965.                 5-61
  3966.  
  3967. GET
  3968. PURPOSE
  3969. Gets a character from the keyboard.
  3970.  
  3971. SYNTAX
  3972. GET strvar/field
  3973.  
  3974. COMMENTS
  3975.  
  3976. This command reads a character from the keyboard into a string variable or
  3977. a text field. It does not wait for a keystroke, and if no key is pressed it
  3978. returns an empty string. If you want GET to wait until a key is pressed,
  3979. you need to place it in a loop, as in:
  3980.  
  3981.     LABEL: GET A$: IF A$=: ""  GOTO LABEL
  3982.  
  3983. Alternatively, use the WAIT command.
  3984.  
  3985. GOSUB
  3986. PURPOSE
  3987. Calls a procedure or subroutine.
  3988.  
  3989. SYNTAX
  3990. GOSUB label
  3991.  
  3992. COMMENTS
  3993.  
  3994. Like the GOTO statement, GOSUB transfers control to a different part of the
  3995. program: it causes the program to branch to the label specified. But unlike
  3996. GOTO, it remembers where it branched from. When the program meets a RETURN
  3997. statement, it jumps back to the line following the GOSUB statement. GOSUB
  3998. is used to call a subroutine; that is, one or more program lines which
  3999. perform a specific task and can be called from different places within the
  4000. main program. Subroutines are useful if the same task needs to be performed
  4001. at several different stages in the program. Instead of repeating a group of
  4002. lines,  it saves space and is more convenient to put them in a subroutine.
  4003.  
  4004.                 5-62
  4005.  
  4006. In DML, a subroutine is defined by a label at the beginning and a RETURN
  4007. statement at the end.
  4008.  
  4009. EXAMPLES
  4010.  
  4011. 1    GOSUB sub1
  4012. 2    x$=Address (1): GOSUB label1
  4013.     x$=Address (2): GOSUB label1
  4014.     .....
  4015.     .....
  4016.     .....
  4017.     label1:
  4018.     ? "This subroutine outputs x$ to the printer"
  4019.     PRINT x$
  4020.     DISPLAY;
  4021.     RETURN
  4022.  
  4023. GOTO
  4024. PURPOSE
  4025. Transfers control to another part of the program.
  4026.  
  4027. SYNTAX
  4028. GOTO label
  4029.  
  4030. COMMENTS
  4031.  
  4032. This statement makes the program jump to the label specified, instead of
  4033. continuing to the next line in the program. It alters the order in which
  4034. DML executes a program. This kind of control transfer is called an
  4035. unconditional jump. For conditional jumps, see the ON GOTO and the IF THEN
  4036. ELSE statement.
  4037.  
  4038. EXAMPLES
  4039.  
  4040. 1    GOTO fred
  4041.     ....
  4042.     ....
  4043.     fred:....
  4044.  
  4045.                 5-63
  4046.  
  4047. GROUP
  4048. PURPOSE
  4049.  
  4050. Specifies the field on which a report is grouped and the field (s) for
  4051. which subtotal reporting is required.
  4052.  
  4053. SYNTAX
  4054. GROUP fieldname [, fieldname] [.....]
  4055.  
  4056. COMMENTS
  4057.  
  4058. Superbase insets a GROUP statement in a report program when you specify
  4059. fields with the GROUP option on the Forms Editor's Report menu. GROUP has
  4060. two main functions. First, it defines the field on which Superbase groups
  4061. data in a report. Second, it specifies any other fields for which
  4062. subtotals-or other reporting features such as MAX and MEAN-are required. If
  4063. you wish to specify several levels of grouping, you should enter a separate
  4064. GROUP statement for each level. GROUP can also be used in an AFTER GROUP
  4065. section as a reference for the field which defines the group. Since the
  4066. group has already changed, entering the field name would output the data
  4067. for the next group; GROUP allows you to retrieve the data for the previous
  4068. group-i.e., the group for which the AFTER GROUP section provides reporting
  4069. information such as subtotals and record counts.
  4070.  
  4071. EXAMPLES
  4072.  
  4073. 1    GROUP City, amount
  4074. 'City' is field on which the report is grouped, 'amount' is a field for
  4075. which subtotals are required-the AFTER GROUP section may include the
  4076. statement:
  4077.     SUM amount
  4078. 2    GROUP Country
  4079.     GROUP City, amount
  4080.  
  4081. In this example, record data is grouped at two levels: City within Country.
  4082.  
  4083.                 5-64
  4084.  
  4085. HEADING
  4086. PURPOSE
  4087. Sets the Report heading for each page.
  4088.  
  4089. SYNTAX
  4090. HEADING
  4091.  
  4092. COMMENTS
  4093.  
  4094. Superbase generates a HEADING statement when you specify a report heading
  4095. using the Heading option on the Forms Editor's Report menu. This statement
  4096. marks the start of a HEADING section and is followed by one or more
  4097. statements which define the heading for a report. The section must end with
  4098. an END HEADING statement. If you wish to include the page number in a
  4099. heading, use the system variable PG, as in:
  4100.  
  4101.     ? @32, "Page"; PG
  4102.  
  4103. PG is set to one when the Report Select command is executed and incremented
  4104. by one after each page.
  4105.  
  4106. EXAMPLES
  4107.  
  4108. 1    HEADING
  4109.     ? @22; BF; U; "DEPOSITS REPORT on", TODAY, "at", NOW; ATTR
  4110.     OFF
  4111.     END HEADING
  4112.  
  4113. HOME
  4114. PURPOSE
  4115. Takes the cursor to the top left-hand corner of the screen.
  4116.  
  4117. SYNTAX
  4118. HOME
  4119.  
  4120. COMMENTS
  4121.  
  4122. Home moves the cursor to the top of the screen without clearing the screen.
  4123. The next screen output will now appear at that position.
  4124.  
  4125.                 5-65
  4126.  
  4127. HOME is useful when you want to overwrite something you have previously
  4128. displayed on screen, or when you want to move the cursor up the screen or
  4129. backwards. Normally, if you attempt to do this with LOCATE or using the @
  4130. parameter with the ? command, DML displays the next page. HOME allows you
  4131. to display text and numbers anywhere on screen, no matter what has been
  4132. displayed previously.
  4133.  
  4134. EXAMPLES
  4135.  
  4136. 1    CLS
  4137.     FOR r%=1 to 18
  4138.     FOR c%=1 to 80
  4139.     HOME: LOCATE c%, r%: ? "Hello"
  4140.     NEXT
  4141.     NEXT
  4142.  
  4143. HRS
  4144. PURPOSE
  4145.  
  4146. Extracts the number of hours from a numeric expression containing the time
  4147. in thousandths of a second.
  4148.  
  4149. SYNTAX
  4150. HRS (nexpr)
  4151.  
  4152. COMMENTS
  4153.  
  4154. nexpr will usually be a time field or the result of a TIMEVAL expression.
  4155.  
  4156. EXAMPLES
  4157.  
  4158. 1 hr%=HRS (timefield)
  4159.  
  4160. IF THEN ELSE
  4161. PURPOSE
  4162. Executes a statement if a condition is true.
  4163.  
  4164. SYNTAX
  4165. IF exp THEN statements[END IF][ELSE statements][END IF]
  4166.  
  4167.                 5-66
  4168.  
  4169. COMMENTS
  4170.  
  4171. exp can be any expression-string, numeric or logical-which is capable of
  4172. being true or false. For example, A$="Smith" is either true or false, so:
  4173.  
  4174.     IF A$="Smith" THEN...
  4175.  
  4176. is a valid statement, but
  4177.  
  4178.     IF A$ THEN...
  4179.  
  4180. is not.
  4181.  
  4182. If exp is true, DML executes the statement or statements after THEN.
  4183. Otherwise it proceeds to the next statement after the IF THEN statement.
  4184. THEN can be omitted when it is followed by GOTO. For example:
  4185.  
  4186.     IF exp GOTO label
  4187.  
  4188. is the same as
  4189.  
  4190.     IF exp THEN GOTO label
  4191.  
  4192. By including the ELSE option, you can instruct DML to choose between two
  4193. courses of action. It executes the statements after THEN if exp is true; if
  4194. exp is false, it executes the statements after ELSE. An IF THEN ELSE
  4195. statement can be split up so that it is placed on several lines. If you do
  4196. this, the statements after THEN must start on a new line, and ELSE must
  4197. also start on a new line. For example:
  4198.  
  4199.     IF x% > y% THEN ? "Greater than" ELSE ? "Less than or equal"
  4200.  
  4201. can be written as:
  4202.  
  4203.     IF x% > y% THEN
  4204.     ? "Greater than"
  4205.     ELSE
  4206.     ? "Less than or equal"
  4207.     END IF
  4208.  
  4209. END IF marks the end of the IF THEN ELSE statement. It should always be
  4210. used when ELSE is placed on a separate line. If it is not used, DML assumes
  4211. that all the separate line statements in the rest of the program belong to
  4212. ELSE.
  4213.  
  4214.                 5-67
  4215.  
  4216. END IF is also used when the ELSE option has not been selected, but the
  4217. statements following THEN are placed on separate lines. For example:
  4218.  
  4219.     IF b$="Yes" THEN n%=1: z%=2: GOSUB label
  4220.  
  4221. can be written:
  4222.  
  4223.     IF b$="Yes" THEN
  4224.     n%=1
  4225.     z%=2
  4226.     GOSUB label
  4227.     END IF
  4228.     .....
  4229.     .....
  4230.  
  4231. Here too, END IF is used to tell DML where the statements belonging to THEN
  4232. finish. exp does not always need to contain an operator. Remember that DML
  4233. assigns a value of 0 to false expressions and -1 to true expressions. With
  4234. IF THEN commands, though, DML treats a numeric expression with any value
  4235. other than zero as true. And it treats a numeric expression with any value
  4236. other than -1 as false.
  4237.  
  4238.     IF EOF ("") THEN .....
  4239.  
  4240. implies:
  4241.  
  4242.     IF EOF ("") <> 0 THEN...
  4243.  
  4244. Likewise, 
  4245.  
  4246.     IF NOT EOF ("") THEN...
  4247.  
  4248. implies
  4249.  
  4250.     IF EOF ("") <> -1 THEN
  4251.  
  4252. EXAMPLES
  4253.  
  4254. 1    IF exp THEN x%=x% + 1
  4255.     IF exp THEN x$="TRUE"
  4256.     IF exp THEN x%=x% + 1: x$="TRUE"
  4257.     IF exp THEN labltrue
  4258.     IF exp THEN GOTO labltrue
  4259. 2    IF exp THEN x$="TRUE" ELSE x$="FALSE"
  4260.     IF exp THEN x$="TRUE": x% + 1 ELSE x$="FALSE"
  4261.     IF exp THEN labltrue ELSE lablfalse
  4262.  
  4263.                 5-68
  4264.  
  4265.     IF exp THEN GOTO labltrue ELSE GOTO lablfalse
  4266. 3    IF b$=MID$ (a$, 3, 1)THEN
  4267.     x%=1
  4268.     GOSUB label1
  4269.     ELSE
  4270.     x%=2
  4271.     GOSUB label2
  4272.     END IF
  4273. 4    IF a$="Y" or a$="y" THEN
  4274.     ? "Yes"
  4275.     ELSE
  4276.     IF a$="N" or a$'"n" THEN
  4277.     ? "No"
  4278.     ELSE
  4279.     ? "Other"
  4280.     END IF
  4281.  
  4282. NOTES
  4283.  
  4284. Example 4 shows how IF THEN statements can be nested. In this case, the
  4285. second IF THEN statement is only executed if the condition in the first
  4286. statement gives a false result.
  4287.  
  4288. IMPORT
  4289. PURPOSE
  4290. Imports an external text file into an open file.
  4291.  
  4292. SYNTAX
  4293. IMPORT filename [TO FILEsbname] [WHERE conditions] [USING parameters]
  4294.  
  4295. COMMENTS
  4296.  
  4297. This command imports the ASCII text file specified by filename into the
  4298. current file or into the file specified by sbfname. It works in the same
  4299. way the IMPORT option in the PROCESS menu. IFTOFILE sbfname is not
  4300. specified, the text file is imported into the current open file. If it is
  4301. specified, sbfname must be an open file.
  4302.  
  4303.                 5-69
  4304.  
  4305. WHERE conditions allows you to add a filter to the command.conditions is
  4306. set up in the same way as the command string in the Filter dialog. USING
  4307. parameters can be used to change the default parameters specified by
  4308. SET-OPTIONS. For a description of USING and the parameters it takes, see
  4309. EXPORT.
  4310.  
  4311. EXAMPLES
  4312.  
  4313. 1    IMPORT "aaa.exp"
  4314. 2    IMPORT "aaa.exp" TO FILE "aaa" WHERE (datefield) > DAYS ("29 Apr 87")
  4315.  
  4316. INDEX
  4317. PURPOSE
  4318. Selects the index to be used with the current file.
  4319.  
  4320. SYNTAX
  4321. INDEX index
  4322.  
  4323. COMMENTS
  4324.  
  4325. Superbase automatically selects the first index as default when you open a
  4326. file or when you make an open file the current file. With the INDEX
  4327. command, you can select another of the file's indexes. index is the name of
  4328. a field in the current file. An index for this field must already exist.
  4329. Because DML parses entire lines before executing them, you cannot place an
  4330. Index statement-or any other statement that refers to a field-on the same
  4331. line as the OPEN FILE statement. When the DML interpreter reaches the INDEX
  4332. statement, the file will not yet be open, and the field name, therefore,
  4333. will not be recognized. As a result, a line like
  4334.  
  4335.     OPEN FILE "aaa": INDEX anum
  4336.  
  4337. will produce an error message such as "Can't do this" or "Can't find this
  4338. field".
  4339.  
  4340. EXAMPLES
  4341.  
  4342. 1    OPEN FILE "aaa"
  4343.     INDEX anum
  4344.  
  4345.                 5-70
  4346.  
  4347. 2    OPEN FILE "aaa": OPEN FILE "bbb"
  4348.     .....
  4349.     .....
  4350.     FILE "aaa": INDEX anum
  4351.     .....
  4352.     FILE "bbb": INDEX datea
  4353.  
  4354. INPUT
  4355. PURPOSE
  4356.  
  4357. Reads characters or a line from a text file on disk into a variable or a
  4358. field.
  4359.  
  4360. SYNTAX
  4361. INPUT[&nexp[, ]/LINE]var/field
  4362.  
  4363. COMMENTS
  4364.  
  4365. This statement inputs data from a text file on disk or from another
  4366. computer using the COMMS link. It assumes that an input channel has been
  4367. opened for example, by OPEN FOR INPUT. With the LINE option, INPUT reads
  4368. data from the input channel until it finds a line feed character (ASCII 10)
  4369. and inputs the data into var or field. If the line feed character has been
  4370. used as the record separator, INPUT LINE reads a record at a time. var can
  4371. be a string or numeric variable and field can be a text, numeric or date
  4372. field. However, in each case the type of variable or field used should
  4373. match the type of data expected. Thus if you attempt to input alphabetic
  4374. characters into a numeric variable they will be valued at zero, while
  4375. inputting them into a date field will produce an invalid date error. &nexp
  4376. specifies the number of characters that the command takes from the text
  4377. file. The comma after nexp is entirely optional. When nexp is zero or when
  4378. & nexp is not used, the command reads characters from the text file until
  4379. it finds a comma (ASCII 44) or a line feed character  (ASCII 10). This
  4380. option allows INPUT to be used instead of IMPORT to read in data from an
  4381. exported file. To detect the end of a text file, use EOF ("*").
  4382.  
  4383.                 5-71
  4384.  
  4385. EXAMPLES
  4386.  
  4387. 1    INPUT LINE a$
  4388. 2    INPUT &6a$ (or INPUT &6, a$)
  4389. 3    INPUT a%
  4390. 4    FILE "aaa": EXPORT TO "aaa.exp"
  4391.     OPEN "aaa.exp" FOR INPUT
  4392.     FOR i%=1 TO RECCOUNT ("aaa")
  4393.     BLANK
  4394.     INPUT field1
  4395.     INPUT field2
  4396.     ........
  4397.     INPUT lastfield
  4398.     STORE
  4399.     NEXT i%: CLOSE INPUT
  4400.  
  4401. Example 4 demonstrates how INPUT can be used as an alternative to IMPORT.
  4402.  
  4403. INSTR
  4404. PURPOSE
  4405.  
  4406. Returns the starting character position of a substring within a string, or
  4407. returns 0 if the substring is not contained within the string.
  4408.  
  4409. SYNTAX
  4410. INSTR[nexpr, ]strexpr, substrexpr)
  4411.  
  4412. COMMENTS
  4413.  
  4414. This function returns the position in strexpr of the first occurrence of
  4415. substrexpr. If nexpr is used, INSTR searches for the first occurrence of
  4416. substrexpr from position nexpr onwards. If the substring is not found, the
  4417. value returned is zero. nexpr must be positive and less than the length of
  4418. strexpr. INSTR is case sensitive, i.e., "abc" and "ABC" are different.
  4419.  
  4420.                 5-72
  4421.  
  4422. EXAMPLES
  4423.  
  4424. 1    x%=INSTR (x$, y$)
  4425. 2    x%=INSTR (textfield, "Mr")
  4426. 3    x%=INSTR (x$, "Mr"): y%=INSTR (x% + 1, x$, "Mr")
  4427. 4    ? LEFT$ (textfield, INSTR (textfield, " ") -1)
  4428. 5    x$=LCASE$ (textfield): x%=INSTR (x$, "abc")
  4429.     IF x% > 0 THEN ? LEFT$ (textfield, x% -1)
  4430.  
  4431. NOTES
  4432.  
  4433. The second example simply locates the title 'Mr.'. Example 3 locates any
  4434. 'Mr and Mrs' or 'Mr & Mrs'. Example 4 displays the first word in textfield.
  4435. Example 5 finds any occurrence of the sequence "abc" in textfield
  4436. regardless of what case the letters are in.
  4437.  
  4438.                 5-73
  4439.  
  4440. INT
  4441. PURPOSE
  4442.  
  4443. Removes the part of a number to the right of the decimal point, turning it
  4444. into a whole number.
  4445.  
  4446. SYNTAX
  4447. INT (nexpr)
  4448.  
  4449. COMMENTS
  4450.  
  4451. INT does not round a decimal number up or down to the nearest whole number,
  4452. but simply strips off the decimal part. Thus INT (123.00001) and INT
  4453. (123.999999) give the same result -123.0.
  4454.  
  4455. EXAMPLES
  4456.  
  4457. 1    numfieldc=INT (numfielda)
  4458. 2    numfieldc=INT (numfielda * (1 + numfield) /100
  4459. 3    $x=INT (VAL (RIGHT$ (textfield, 2)) /3.33
  4460. 4    $x=INT ($y)
  4461. 5    ? INT ($x ^ Sy)
  4462.  
  4463.                 5-74
  4464.  
  4465. KEY
  4466. PURPOSE
  4467.  
  4468. Displays the current set of function key definitions, or defines a new set.
  4469.  
  4470. SYNTAX
  4471. KEY keynum[, string]
  4472.  
  4473. COMMENTS
  4474.  
  4475. For the GEM versions of Superbase Professional running under MS DOS, the
  4476. available function keys are F1 to F10. Each of these can be used with
  4477. SHIFT,  CONTROL OR ALT, giving 40 function keys in all. The numbers
  4478. associated with the keys are:
  4479.  
  4480.     F1-F10            1-10
  4481.     SHIFT (F1-F10)        11-20
  4482.     CONTROL (F1-F10)        21-30
  4483.     ALT (F1-F10)        31-40
  4484.  
  4485. On the AMIGA and the Atari ST, 21 function keys are available: the keys F1
  4486. to F10, which can be used with SHIFT, and the HELP key (HELP and Shift HELP
  4487. are the same). Their numbers are:
  4488.  
  4489.     F1 to F10        1-10
  4490.     SHIFT (F1-F10)        11-20
  4491.     HELP            0
  4492.  
  4493. string can be any set of Superbase commands which can be entered on one
  4494. line (provided that they do not access a field on the same line as an OPEN
  4495. FILE). The command line in string is assigned to the key specified by
  4496. keynum Using KEY without a following command string clears the key
  4497. associated with keynum. If keynum and string and not used, KEY displays the
  4498. current set of function key definitions.
  4499.  
  4500. EXAMPLES
  4501.  
  4502. 1    KEY 1
  4503. 2    KEY 1, "OPEN FILE ~aaa~: BLANK: ENTER: STORE: ? ~ Now 
  4504.     ~; RECCOUNT (~aaa~); ~Records~"
  4505.  
  4506.                 5-75
  4507.  
  4508. 3    KEY
  4509. 4    KEY 3, "Tel. (0428) 725400 [(04203) 5601 evenings]"
  4510.  
  4511. Example 1 clears key F1. Example 2 sets F3 to enter a record into a file
  4512. and report how many records there now are. Note the use of the tilde
  4513. character to insert quotation marks. Since the entire string must be
  4514. enclosed in quotation marks, you cannot use quotation marks within the
  4515. string.
  4516.  
  4517.                 5-76
  4518.  
  4519. LABELS
  4520. PURPOSE
  4521. Prints records as labels.
  4522.  
  4523. SYNTAX
  4524. LABELS [FILE sbfname] [WHERE conditions] [USING labelparams]
  4525.  
  4526. COMMENTS
  4527.  
  4528. This command is the program equivalent of selecting the Labels option from
  4529. the PROCESS menu. It allows you print out records as labels and to define
  4530. their format. WHERE conditions limits the records for which labels are
  4531. printed and acts as a filter. USING allows you to specify the shape and
  4532. content of the labels to be printed. labelparams is a series of parameters
  4533. separated by commas, relating to the label definition dialog. Reading down
  4534. the left column of the dialog and then down the right column, they are as
  4535. follows:
  4536.  
  4537.     line 1 fields/line
  4538.     line 2 fields/line
  4539.     line 3 fields/line
  4540.     line 4 fields/line
  4541.     line 5 fields/line
  4542.     line 6 fields/line
  4543.     line 7 fields/line
  4544.     line 8 fields/line
  4545.     line 9 fields/line
  4546.     line 10 fields/line
  4547.     First label margin
  4548.     label text width
  4549.     Second label margin
  4550.     First line next label
  4551.     Copies per label
  4552.     Labels per line
  4553.  
  4554. Note: All 16 parameters must be used.
  4555.  
  4556. If USING is not specified, LABELS takes the default parameters as shown in
  4557. the label definition dialog (see Volume 1, Chapter 5).
  4558.  
  4559.                 5-77
  4560.  
  4561. EXAMPLES
  4562.  
  4563. 1    LABELS WHERE CITY="London"
  4564.     USING 1, 0, 2, 1, 1, 1, 1, 1, 0, 0, 1, 35, 40, 12, 1, 2
  4565. 2    LABELS "Address" WHERE Lastname LIKE "[a-c}*"
  4566.  
  4567. LCASE$
  4568. PURPOSE
  4569. Converts a text string to lowercase.
  4570.  
  4571. SYNTAX
  4572. LCASE$ (strexpr)
  4573.  
  4574. COMMENTS
  4575.  
  4576. This function changes upper case letters to lower case; no other characters,
  4577.  including those already in lowercase, are affected. The complementary
  4578. function of LCASE$ is UCASE$.
  4579.  
  4580. EXAMPLES
  4581.  
  4582. 1    textfieldc=LCASE$ (textfielda)
  4583. 2    x$=LCASE$ (y$)
  4584. 3    x$=LCASE$ ("ABCDEF")
  4585. 4    ? LCASE$ (x$)
  4586.  
  4587. LEFT$
  4588. PURPOSE
  4589.  
  4590. Extracts one or more characters from a string, starting at the left of the
  4591. string.
  4592.  
  4593. SYNTAX
  4594. LEFT$ (strexpr, nexpr)
  4595.  
  4596.                 5-78
  4597.  
  4598. COMMENTS
  4599.  
  4600. LEFT$ returns the leftmost nexpr characters of the string strexpr. Thus, if
  4601. strexpr is DICTIONARY and expr is 7:
  4602.  
  4603.     LEFT$ ("DIRECTIONARY", 7)
  4604.  
  4605. returns DICTION.
  4606.  
  4607. EXAMPLES
  4608.  
  4609. 1    textfieldc=LEFT$ (textfielda, 10)
  4610. 2    textfieldc=UCASE$ (LEFT$ (textfielda, 1))
  4611.     + MID$ (testfielda, 2)
  4612. 3    LEFT$ (textfielda, 1) LIKE [a-c]
  4613. 4    x$=LEFT$ ("ABCD", 2)
  4614. 5    x$=LEFT$ (x$, n$)
  4615. 6    ? LEFT$ (x$, 10)
  4616. 7    strip: IF LEFT$ (x$, 1) =" " THEN x$=MID$ (x$, 2): GOTO strip
  4617.  
  4618. NOTES
  4619.  
  4620. Example 7 is a one line program to strip leading spaces from x$ (see
  4621. LTRIM$).
  4622.  
  4623.                 5-79
  4624.  
  4625. LEN
  4626. PURPOSE
  4627. Returns the number of characters in a text string or text field.
  4628.  
  4629. SYNTAX
  4630. LEN (strexpr)
  4631.  
  4632. COMMENTS
  4633.  
  4634. LEN counts the number of characters in a string, including spaces and non-
  4635. printing characters.
  4636.  
  4637. EXAMPLES
  4638.  
  4639. 1    numfieldc=LEN (textfielda)
  4640. 2    textfieldc=RIGHT$ (textfielda, LEN (testfieldb)
  4641. 3    LEN (textfielda) > 25 AND LEN (textfielda) 50
  4642. 4    x$=LEN ("A")
  4643. 5    x$=LEN (x$)
  4644. 6    x$=LEN (MID$ (extfield, 3))
  4645. 7    ? LEN (x$)
  4646.  
  4647. LET
  4648. PURPOSE
  4649. Assign a value to a variable.
  4650.  
  4651. SYNTAX
  4652. [LET] var/field=expr/[expr1 ? expra: exprb]
  4653.  
  4654. COMMENTS
  4655.  
  4656. The keyword LET is optional and is usually omitted. In other words, to
  4657. assign a value to a variable or a field, you only need to use the equal
  4658. sign.
  4659.  
  4660.                 5-80
  4661.  
  4662. The LET option has been included in DML to maintain compatibility with
  4663. earlier versions of Basic. DML also provides a more unusual facility when
  4664. you use the syntax:
  4665.  
  4666. var/field=expr1 ? expra: exprab
  4667.  
  4668. This option provides a short way of assigning different values to a
  4669. variable or field, depending on whether an expression is true or not; that
  4670. is, it makes assignment conditional on the truth or falsity of a specified
  4671. expression. If expr1 is true, expra is assigned to the variable or field; if
  4672. it is false, exprb is assigned. It is equivalent to
  4673.  
  4674.     IF expr1
  4675.     THEN var/field=expra
  4676.     ELSE var/field=exprab
  4677.  
  4678. Used in this way, the question mark character is referred to as a 'ternary
  4679. operator' to reflect the fact that three operands are required at the right
  4680. of the equal sign. In fact, you can chain ternary operators together to
  4681. create a statement which contains multiple conditions and assigns one of
  4682. multiple values. Within a program, however, you will generally find it
  4683. easier to use the IF THEN ELSE statement. The main application for the
  4684. ternary operator is in a Superbase file definition. Here it has an
  4685. important advantage over the IF THEN ELSE statement: it can be entered as a
  4686. calculation formula for a field in a file definition. For a fuller
  4687. discussion of the ternary operator and its applications, see Chapter 2,
  4688. Volume 1.
  4689.  
  4690. EXAMPLES
  4691.  
  4692. 1    item$="Sprocket"
  4693. 2    Textfielda="London"
  4694. 3    b%=3.25
  4695. 4    numfieldb=INT (277/62)
  4696.  
  4697. The following examples assume that x$="ABC" and x%=4.5
  4698. 5    y$= (x$="ABC") ? "yes": "no"
  4699. This example assigns "yes" to y$.
  4700.  
  4701.                 5-81
  4702.  
  4703. 6    y$= (x$="aaa") ? x$: ""
  4704. Assigns "" to y$.
  4705. 7    y$= (x% > 3.5) ? "yes": "no"
  4706. Assigns "yes" to y$
  4707. 8    y$=EOF ("INPUT") ? "end of file": "more to read"
  4708.  
  4709. LIST
  4710. PURPOSE
  4711. Lists a text file to the screen.
  4712.  
  4713. SYNTAX
  4714. LIST filename
  4715.  
  4716. COMMENTS
  4717.  
  4718. LIST is the program equivalent of the LIST option in the SYSTEM menu. It
  4719. displays a text file on the screen. Do not confuse LIST with ? LIST, which
  4720. displays a program listing. LIST only works with text files. Note also that
  4721. unlike many other DML commands, LIST requires the file name itself plus its
  4722. extension name.
  4723.  
  4724. EXAMPLES
  4725.  
  4726. 1    LIST "aaa.exp"
  4727. 2    LIST "Address.sbd"
  4728.  
  4729.                 5-82
  4730.  
  4731. LOAD
  4732. PURPOSE
  4733. Loads any of the following types of file into memory: programs, text files,
  4734. function key files, Query and Update files.
  4735.  
  4736. SYNTAX
  4737. LOAD [TEXT]/[KEY]/[QUERY]/[UPDATE]filename[, APPEND]
  4738.  
  4739. COMMENTS
  4740.  
  4741. If none of the options TEXT, KEY, QUERY or UPDATE is used, Superbase
  4742. assumes that filename refers to a '.sbp' file and attempts to load a
  4743. PROGRAM file. The APPEND option can be used with program files and text
  4744. files to append a file on disk to the file in memory. Note that LOAD cannot
  4745. be used to load a Superbase data file (a file with an '.sbf' extension).
  4746. For this you need to use the OPEN FILE command.
  4747.  
  4748. EXAMPLES
  4749.  
  4750. 1    LOAD "Program1"
  4751. 2    LOAD TEXT "Banklet"
  4752. 3    LOAD QUERY "Deptran"
  4753. 4    LOAD KEY "Funkey1"
  4754. 5    LOAD TEXT "Document2", APPEND
  4755.  
  4756.                 5-83
  4757.  
  4758. LOCATE
  4759. PURPOSE
  4760.  
  4761. Sets the position at which the next output appears on the current output
  4762. device (generally, the screen or the printer).
  4763.  
  4764. SYNTAX
  4765. LOCATE column[, row]
  4766.  
  4767. COMMENTS
  4768.  
  4769. When you are displaying something on the screen, LOCATE allows you to
  4770. specify where it appears. column and row must be numeric expressions.row is
  4771. optional and if it is not included, LOCATE moves the cursor to the
  4772. specified column position on the current line. You cannot use LOCATE to
  4773. move the cursor backwards or up the screen: it will not move the cursor to
  4774. a position on the same line which is to the left of the current
  4775. position; and it will not move the cursor to a line above the current
  4776. position. However, you can bypass this restriction if you place the HOME
  4777. statement in front of LOCATE-see HOME.
  4778.  
  4779. EXAMPLES
  4780.  
  4781. 1    LOCATE 12, 5: ? "Hello"
  4782. 2    c%=12: r%=1: LOCATE c%, r%
  4783. 3    LOCATE 12: ? "Hello"
  4784.  
  4785. NOTES
  4786.  
  4787. The first example displays the word 'hello' at the 12th column on the sixth
  4788. row. Example 3 displays 'hello' at the 12th column of whatever line the
  4789. cursor happens to be on.
  4790.  
  4791.                 5-84
  4792.  
  4793. LOG
  4794. PURPOSE
  4795. Returns the natural logarithm (log to the base 'e') of a number.
  4796.  
  4797. SYNTAX
  4798. LOG (nexpr)
  4799.  
  4800. COMMENTS
  4801.  
  4802. The value of nexpr must be positive. Negative numbers or zero produce the
  4803. error message 'Invalid numeric parameter'.
  4804.  
  4805. EXAMPLES
  4806.  
  4807. 1    numfieldc=LOG (numfielda)
  4808. 2    numfieldc=LOG (datefielda-datefieldb)
  4809. 3    numfieldc > LOG (numfielda * numfieldb)
  4810. 4    x%=LOG (y%)
  4811. 5    x%=LOG (y% * numfielda * (datefielda-datefieldb))
  4812.  
  4813. LOOKUP
  4814. PURPOSE
  4815. Detects whether an expression occurs in a file in a specified field.
  4816.  
  4817. SYNTAX
  4818. LOOKUP (expr, field.file)
  4819.  
  4820. COMMENTS
  4821.  
  4822. This function checks whether a given field in a file contains the
  4823. expression in expr. That is, it answers the question: does expr exist in
  4824. field.file? If it finds the expression, LOOKUP returns the value -1 (true);
  4825. otherwise it returns the value 0 (false). expr and field.file must be of
  4826. the same type (i.e. text or numeric). field.file must be the name of an
  4827. indexed field in an open file.
  4828.  
  4829.                 5-85
  4830.  
  4831. LOOKUP plays a major role in cross-file validation and calculation. The
  4832. file specified with LOOKUP can be any open file; so you can use this
  4833. function to perform a relational lookup, where it checks whether the
  4834. contents of a field in one file match the contents of a field in another
  4835. file. If LOOKUP is successful-if it finds the expression you have
  4836. specified-the record containing the expression becomes the current record,
  4837. even though the file may not be the current file and is not displayed on
  4838. screen. At the same time, the FOUND function is set to -1 to reflect the
  4839. fact that the search has been successful. For a fuller explanation of
  4840. LOOKUP, see Chapter 2, Volume 1.
  4841.  
  4842. EXAMPLES
  4843.  
  4844. 1    OPEN FILE "aaa": OPEN FILE "bbb"
  4845.     SELECT FIRST
  4846.     WHILE NOT EOF ("bbb")
  4847.     IF LOOKUP (field1.bbb, field1.aaa) THEN GOSUB Process_module
  4848.     WEND
  4849.     ? "Process completed": END
  4850.     Process_module:
  4851.     ......
  4852.     ......
  4853.     RETURN
  4854.  
  4855. This example demonstrates a small program to process only those records in
  4856. file 'bbb' that have a matching record in file 'aaa'. File 'bbb' could be
  4857. an invoice file 'joined' to a customer file 'aaa' by a customer code
  4858. (field1 in 'bbb' and 'aaa').
  4859.  
  4860.                 5-86
  4861.  
  4862. LTRIM$
  4863. PURPOSE
  4864. Trims leading spaces from a text expression or a text field.
  4865.  
  4866. SYNTAX
  4867. LTRIM$ (strexpr)
  4868.  
  4869. COMMENTS
  4870.  
  4871. LTRIM$ returns a string consisting of the original string specified by
  4872. strexpr with any leading spaces removed.
  4873.  
  4874. EXAMPLES
  4875.  
  4876. 1    textfieldc=LTRIM$ (textfielda)
  4877. 2    x$=LTRIM$ (textfieldc.filea)
  4878. 3    ? LEN (x$); LEN (LTRIM$ (x$))
  4879.  
  4880.                 5-87
  4881.  
  4882. MAKE
  4883. PURPOSE
  4884. Stores the file definition for a file it has been defined by CREATE and
  4885. ADD.
  4886.  
  4887. SYNTAX
  4888. MAKE sbfname
  4889.  
  4890. COMMENTS
  4891.  
  4892. This command is used as the last step in the process of creating a new
  4893. file. After the file has been defined by CREATE and ADD, MAKE writes the
  4894. new file definition to disk together with any indexes that have created.
  4895. Note that a file definition is not regarded as valid until the MAKE command
  4896. has been executed. Before then, any error will have the effect of removing
  4897. the file definition.
  4898.  
  4899. EXAMPLES
  4900.  
  4901. 1    CREATE "Address"
  4902.     ADD "Firstname; TXT REQ; 20; 1, 2"
  4903.     ADD "Lastname; TXT REQ IXD; 20; 1, 33"
  4904.     ADD "Street"; TXT; 25; 3, 2"
  4905.     (other field definitions)
  4906.     ........
  4907.     ........
  4908.     MAKE "Address"
  4909.  
  4910.                 5-88
  4911.  
  4912. MENU
  4913. PURPOSE
  4914. Sets up a user-define menu
  4915.  
  4916. SYNTAX
  4917. MENU column, item, state[, strexpr]
  4918.  
  4919. COMMENTS
  4920.  
  4921. Superbase let you define up to 10 menu each of which can have a maximum of
  4922. 12 items. With the Menu command you supply the text for a single item and
  4923. specify whether it will appear on the menu an enabled, disabled (ghosted)
  4924. or with a check mark against it. Having defined a menu with a series of
  4925. MENU commands-one for each menu item and one for the menu title-you can
  4926. then use the MENU ON command to turn the menu (or menus) on. You also use
  4927. MENU to specify a numeric variable which will return a value showing which
  4928. item, if any, has been selected. column must be a numeric expression with a
  4929. value in the range 1 to 10 giving the column number for the menu. To set up
  4930. a menu in the first column on the left at the same position as the
  4931. Superbase Project menu, you would enter a value of one. item must be a
  4932. numeric expression with a value in the range 0 to 12, giving the number of
  4933. the menu item. Item 0 is the menu heading, the text that appears on the
  4934. menu bar. state can take a value of 0, 1 or 2.0 disables the item so that
  4935. it appears on the menu as a ghosted option.1 enables it, 2 places a check
  4936. mark against it. strexpr supplies the text for the item. For example, if
  4937. you wished to define a menu in the first column which contained the option
  4938. Deposits, you could enter:
  4939.  
  4940.     MENU 1, 3, 1, "Deposits"
  4941.  
  4942. This would make Deposits the third item in the menu list. To disable the
  4943. Deposits option, you would enter:
  4944.  
  4945.     MENU 1, 3, 0
  4946.  
  4947. Note that you do not need to specify the text a second time.
  4948.  
  4949.                 5-89
  4950.  
  4951. EXAMPLES
  4952.  
  4953. 1    MENU 1, 0, 1, "Transactions"
  4954.     MENU 1, 1, 1, "Deposits"
  4955.     MENU 1, 2, 1, "Withdrawal"
  4956.     MENU 1, 3, 1, "Direct debit"
  4957.     MENU 1, 4, 1, "Standing orders"
  4958.     MENU 1, 5, 1, "Credit card"
  4959.     MENU ON a%, b%
  4960.  
  4961. NOTES
  4962.  
  4963. This example defines a menu in the first column with five options (items),
  4964. all of them enabled. (The heading for the menu is Transactions.) MENU ON
  4965. then turns the menu on. When the user selects an item, Superbase will place
  4966. its column and item numbers in the variables a% and b%.
  4967.  
  4968. MENU CLEAR
  4969. PURPOSE
  4970. Turns off all user-defined menus and clears their definitions from memory.
  4971.  
  4972. SYNTAX
  4973. MEMORY CLEAR
  4974.  
  4975. COMMENTS
  4976.  
  4977. If you want to define a new set of menus, you can use this command to clear
  4978. any menus which have been defined previously. You may also use it when your
  4979. menus are no longer required, in order to make the memory space they occupy
  4980. available for other purposes.
  4981.  
  4982.                 5-90
  4983.  
  4984. MENU ON
  4985. PURPOSE
  4986. Turns user-defined menus on and specifies the variables which return the
  4987. result of a menu selection.
  4988.  
  4989. SYNTAX
  4990. MENU ON nvar1, nvar2
  4991.  
  4992. COMMENTS
  4993.  
  4994. MENU ON turns on any menus which have been defined with the MENU command
  4995. and sets nvar1 and nvar2 to zero. When the user selects an item, Superbase
  4996. places the column number in nvar1 and places the item number in nvar2. It
  4997. also turns all the user-defined menus off. For example, if the second item
  4998. in the third user-defined menu has been selected, the first numeric
  4999. variable specified with MENU ON, will contain the value 3 and the second
  5000. numeric variable will contain the value 2. You may sometimes want to turn
  5001. the menus off without waiting for an item to be selected. You can do this
  5002. with the command MENU OFF.
  5003.  
  5004. EXAMPLES
  5005.  
  5006. 1    menuloop:
  5007.     MENU ON a%, b%
  5008.     ON a% GOSUB sub1, sub2, sub3, sub4, sub5
  5009.     GOTO menuloop
  5010.  
  5011. NOTES
  5012.  
  5013. This examples presumes that five menus have been defined and that sub1 to
  5014. sub5 are subroutines which handle item selection for each menu.
  5015.  
  5016.                 5-91
  5017.  
  5018. MERGE
  5019. PURPOSE
  5020. Loads a text file and performs a mail merge.
  5021.  
  5022. SYNTAX
  5023. MERGE [TEXT filename] [WHERE conditions]
  5024.  
  5025. COMMENTS
  5026.  
  5027. This command merges the data in an '.sbf' file with a form letter in the
  5028. Text Editor and outputs the results to the printer. It takes data from the
  5029. current open file and-if WHERE is not included-prints one letter for each
  5030. record in the file. You can use WHERE to set up a filter restricting the
  5031. merge operation to only those records which match the conditions specified.
  5032. The TEXT option lets you specify a text file on disk; Superbase will then
  5033. load the file into the Text Editor before starting the merge operation.
  5034. Although Merge is the program equivalent of the Mail Merge option on the
  5035. Process menu, it does not allow you to preview letters on screen before
  5036. printing them. To do this, use ? TEXT with the MERGE parameter.
  5037.  
  5038. EXAMPLES
  5039.  
  5040. 1    OPEN FILE "Address"
  5041.     MERGE TEXT "Mailshot1" WHERE Country LIKE "USA"
  5042.  
  5043. MID$
  5044. PURPOSE
  5045. Returns one or more characters from within a text string or text field.
  5046.  
  5047. SYNTAX
  5048. MID$ (strexpr, nexpr1[, nexpr2])
  5049.  
  5050. COMMENTS
  5051.  
  5052. MID$ is more flexible than LEFT$ and RIGHT$ as it can extract characters
  5053. from any point in a string.strexpr holds the string, and nexpr1 gives the
  5054. starting point in the string.nexpr2 specifies the length of the substring
  5055. to be extracted; if nexpr2 is not given, MID$ takes all the characters from
  5056. the starting point to the end.
  5057.  
  5058.                 5-92
  5059.  
  5060. EXAMPLES
  5061.  
  5062. 1    textfieldc=MID$ (textfielda, 10, 10)
  5063. 2    textfieldc=LCASE$ (MID$ (textfielda, 8))
  5064. 3    MID$ (textfielda, 12, 1) LIKE[a-c]
  5065. 4    x$-MID$ (textfieldc, 19, 2)
  5066. 5    x$= (x$, 4)
  5067. 6    ? MID$ (x$, 4, 2)
  5068. 7    ASK;A$:
  5069.     I%=LEN (A$)
  5070.     FOR n%=I% TO 1 STEP -1
  5071.     B$=B$ + MID$ (A$, n%, 1)
  5072.     NEXT
  5073.     ? B$
  5074.  
  5075. NOTES
  5076.  
  5077. Example 7 inputs a word into A$ and turns it back to front.
  5078.  
  5079.                 5-93
  5080.  
  5081. MINS
  5082. PURPOSE
  5083.  
  5084. Extracts the number of minutes from a numeric value which holds the time in
  5085. thousandths of a second.
  5086.  
  5087. SYNTAX
  5088. MINS (nexpr)
  5089.  
  5090. COMMENTS
  5091.  
  5092. Usually, nexpr will be a timefield or the result of a TIMEVAL calculation.
  5093.  
  5094. EXAMPLES
  5095.  
  5096. 1    mnts%=MINS (timefield)
  5097. 2    ? MINS (NOW - start%); "minutes have elapsed"
  5098.  
  5099. MOD
  5100. PURPOSE
  5101. Gives the remainder of a numeric expression after it has been divided.
  5102.  
  5103. SYNTAX
  5104. nexpr1 MOD nexpr2
  5105.  
  5106. COMMENTS
  5107.  
  5108. nexpr1 is the number to be divided, nexpr2 is the number that divides into
  5109. it (the divisor). MOD returns the remainder when nexpr1 has been divided by
  5110. nexpr2. For example:
  5111.  
  5112.     14 MOD 3
  5113.  
  5114. gives 2 as a result. It is equivalent to:
  5115.  
  5116.     14-INT (14/3) * 3
  5117.  
  5118. EXAMPLES
  5119.  
  5120. 1    ? (2.53 * 100) MOD 100
  5121.  
  5122.                 5-94
  5123.  
  5124. NOTES
  5125.  
  5126. The example line strips off the integer part of a number and displays the
  5127. first two figures after the decimal place.
  5128.  
  5129. MODIFY
  5130. PURPOSE
  5131. Modifies a field definition.
  5132.  
  5133. SYNTAX
  5134. MODIFY field[, ] [field definition string] [, formula] [, formula]
  5135.  
  5136. COMMENTS
  5137.  
  5138. MODIFY is the program equivalent of the EDIT FILE option in PROJECT. It
  5139. allows you to alter a field's parameters; for example, the field name or its
  5140. length. The field definition and formula strings take the same form as they
  5141. do with the ADD command.
  5142.  
  5143. EXAMPLES
  5144.  
  5145. 1    MODIFY Forename "Firstname; TXT REQ IXU; 15 U; 1, 12"
  5146.  
  5147.                 5-95
  5148.  
  5149. MONTH$
  5150. PURPOSE
  5151. Takes a julian date number and returns the month of the year as a text
  5152. string.
  5153.  
  5154. SYNTAX
  5155. MONTH$ (nexpr)
  5156.  
  5157. COMMENTS
  5158.  
  5159. The same limitations on which julian dates are acceptable apply to this
  5160. function as they do to other date functions. The format of the text string
  5161. is the full month name regardless of what current date format is - i.e.,
  5162. January, not Jan). Associated date functions are DAY DAYS DAY$ MONTH MONTH$
  5163. YEAR.
  5164.  
  5165. EXAMPLES
  5166.  
  5167. 1    textfieldc=MONTHS$ (datefielda)
  5168. 2    textfieldc=MONTH$ (datefielda + 90)
  5169. 3    textfieldc=MONTH$ (TODAY)
  5170. 4    x$=MONTH$ (datefielda + VAL (textfielda))
  5171. 5    x$=MONTH$ (DAYS  ("11 Jan 85")
  5172. 6    ? MONTH$ (datefielda + 30)
  5173.  
  5174.                 5-97
  5175.  
  5176. NEW
  5177. PURPOSE
  5178. Clears the program area or text area.
  5179.  
  5180. SYNTAX
  5181. NEW [TEXT/QUERY/UPDATE]
  5182.  
  5183. COMMENTS
  5184.  
  5185. On its own, NEW erases any program that is currently in the computer's
  5186. memory. When followed by TEXT, it clears the current text editor area of
  5187. memory. Following it by or QUERY or UPDATE, clears their respective
  5188. dialogs. Unlike the menu options Program New (and Text New) this command
  5189. does not put you into the program (or text) editor.
  5190.  
  5191. NEWLINE
  5192. PURPOSE
  5193. Sends a new line character (or characters) to an output device.
  5194.  
  5195. SYNTAX
  5196. NEWLINE[nexp]
  5197.  
  5198. COMMENTS
  5199.  
  5200. This command prints a new line at the current output device; i.e. with the
  5201. screen display, it takes the cursor onto the start of the next line.nexp
  5202. can be used to specify more than one new line. If nexp is not an integer,
  5203. only the integer part will be taken.
  5204.  
  5205. EXAMPLES
  5206.  
  5207. 1    NEWLINE 2
  5208. 2    FOR i%=1 to 20
  5209.     ? i%: if i% MOD 5=0 THEN NEWLINE i%/5
  5210.     NEXT i%
  5211.  
  5212.                 5-98
  5213.  
  5214. NOTES
  5215.  
  5216. Example 2 outputs the numbers 1 to 5 with single line spacing, 6 to 10 with
  5217. double spacing, and so on up to 20.
  5218.  
  5219. NOW
  5220. PURPOSE
  5221. Gives the system time.
  5222.  
  5223. SYNTAX
  5224. NOW
  5225.  
  5226. COMMENTS
  5227.  
  5228. NOW shows the time of day in hours and minutes, using the current time
  5229. format. If you have a real-time clock in your computer or you have set the
  5230. system time,  this will be the current time. Note that NOW actually holds
  5231. the time in thousandths of a second. When you display the time, Superbase
  5232. automatically translates it into hours and minutes.
  5233.  
  5234. EXAMPLES
  5235.  
  5236. 1    ? NOW
  5237. 2    ? MINS (NOW)
  5238. 3    timefield=NOW
  5239.  
  5240.                 5-99
  5241.  
  5242. NUMBASE
  5243. PURPOSE
  5244. Sets the numeric format in which numbers are displayed.
  5245.  
  5246. SYNTAX
  5247. NUMBASE string
  5248.  
  5249. COMMENTS
  5250.  
  5251. NUMBASE is the program equivalent of the Number Format option in the SET
  5252. menu. string must be one of Superbase's valid numeric formats, as listed
  5253. Chapter 2,  Volume 1. For example, "z99999.00" or "z (+$, 000000.00".
  5254.  
  5255. EXAMPLES
  5256.  
  5257. 1    NUMBASE "z99999."
  5258. Integer only format.
  5259. 2    NUMBASE "+*****.00"
  5260. Numbers displayed with a sign and leading cheque-protect.
  5261.  
  5262. ON ERROR
  5263. PURPOSE
  5264. Tells DML to branch to another part of the program when an error occurs.
  5265.  
  5266. SYNTAX 
  5267. ON ERROR [[GOTO] label]
  5268.  
  5269. COMMENTS
  5270.  
  5271. Normally, DML halts program execution and displays an error message when it
  5272. detects an error. ON ERROR enables error trapping, and prevents the program
  5273. from halting. Once an error has been detected, it causes the program to
  5274. jump to the error handling routine specified with label. You can use ERRNO
  5275. in your error handling routine to check on which error has occurred, and
  5276. take appropriate action. In many cases, you will want the program to resume
  5277. execution after detecting an error. You can do this with the RESUME
  5278. statement.
  5279.  
  5280.                 5-100
  5281.  
  5282. To disable error trapping, use ON ERROR without a following label.
  5283.  
  5284. EXAMPLES
  5285.  
  5286. 1    ON ERROR GOTO check
  5287.     ......
  5288.     ......
  5289.     ......
  5290.     check: IF ERRNO 11 THEN
  5291.     RESUME
  5292.     ELSE? "Are you sure you want to exit from this program?"
  5293.     ? "Press Y to exit, any another key to resume"
  5294.     WAIT a$
  5295.     IF a$="Y" OR a$="y" THEN END ELSE RESUME
  5296.     ENDIF
  5297.  
  5298. NOTES
  5299.  
  5300. In this example, ON ERROR is used to check whether the Stop button has been
  5301. clicked on or CTRL C has been pressed. Both these events generate error
  5302. number 11, so the error handling routine (which starts at label 'check')
  5303. first tests for this error number. If it finds that another error event has
  5304. occurred, program execution is resumed at the line which caused the error.
  5305. The error handling routine then asks if the user wishes to exit or not.
  5306. Depending on the answer it receives, it either resumes execution at the
  5307. line which caused the error (the line being executed when the user pressed
  5308. STOP or CTRL C) or terminates the program.
  5309.  
  5310.                 5-101
  5311.  
  5312. ON GOSUB
  5313. PURPOSE
  5314. Calls one of a number of subroutines from a list of subroutines.
  5315.  
  5316. SYNTAX
  5317. ON nexp GOSUB label1 [, label2, label3, ...]
  5318.  
  5319. COMMENTS
  5320.  
  5321. This statement transfers program control to one of the subroutines given in
  5322. the list. The value of nexp determines which subroutine the program jumps
  5323. to. If nexp has valued at 1 the program branches to the subroutine at the
  5324. first label,  if nexp has a value of 2, it branches to the subroutine at
  5325. the second label, and so on. Once the program has branched to a subroutine,
  5326. it executes each statement in turn until it meets a RETURN statement. Then
  5327. it jumps back to the line following the ON GOSUB statement. Any label can
  5328. be repeated. If nexp is 0 or greater than the number of supplied labels,
  5329. program control drops to the next statement after the ON GOSUB statement.
  5330.  
  5331. EXAMPLES
  5332.  
  5333. 1    ON x% GOSUB lab1, lab2, lab3
  5334. 2    ON x% GOSUB lab1, lab2, lab1, lab2, lab1
  5335.  
  5336. ON GOTO
  5337. PURPOSE
  5338. Branches to one of a list of labels.
  5339.  
  5340. SYNTAX
  5341. ON nexp GOTO label [, label, ....]
  5342.  
  5343. COMMENTS
  5344.  
  5345. This command transfers program control to one of the program lines given in
  5346. the list. The value of nexp determines which label the program jumps to.
  5347.  
  5348.                 5-102
  5349.  
  5350. If nexp has valued at 1 the program branches to the first label, if nexp
  5351. has a value of 2, it branches to the second label, and so on. For a general
  5352. description of GOTO refer to GOTO itself. nexp should be a positive integer.
  5353. If it is not an integer, the whole number part will be taken. Any label can
  5354. be repeated. If nexp is 0 or greater than the number of supplied labels,
  5355. program control drops to the next statement after ON GOTO.
  5356.  
  5357. EXAMPLES
  5358.  
  5359. 1    ON x% GOTO lab1, lab2, lab3
  5360. 2    ON x% GOTO lab1, lab2, lab1, lab2, lab1
  5361.     ? "Reached here only when x% is 0 or greater than 5
  5362.  
  5363. OPEN
  5364. PURPOSE
  5365. Opens a text file on disk or Comms channel for input/output.
  5366.  
  5367. SYNTAX
  5368. OPEN filename FOR[INPUT/OUTPUT/APPEND]
  5369.  
  5370. COMMENTS
  5371.  
  5372. When used for output to a file, OPEN has the same effect as OUTPUT TO file.
  5373. There is only one channel for INPUT, and one for OUTPUT, so you cannot have
  5374. two output channels, or two input channels. However, you can have one of
  5375. each open at the same time. APPEND is an output channel and specifies that
  5376. file is to be appended to. You must not try to specify OPEN "aaa" FOR
  5377. OUTPUT APPEND. If using OPEN, file is overwritten without warning. If using
  5378. APPEND, file need not exist. If using INPUT, file must exist.
  5379.  
  5380.                 5-103
  5381.  
  5382. EXAMPLES
  5383.  
  5384. 1    OPEN "aaa" FOR OUTPUT
  5385. 2    OPEN "aaa" FOR APPEND
  5386. 3    OPEN "bbb" FOR INPUT: OPEN "aaa" APPEND
  5387.     lab1: INPUT LINE a$: ? a$
  5388.     IF NOT EOF  ("*") THEN GOTO lab1
  5389.     CLOSE INPUT: CLOSE OUTPUT
  5390.  
  5391. NOTES
  5392.  
  5393. Example 3 appends the contents of file 'bbb' to file 'aaa'. Notice that the
  5394. last line of the program CLOSEs the files that OPEN has opened. This
  5395. practise is strongly recommended: you should always close a file when you
  5396. have finished writing to it.
  5397.  
  5398. OPEN FORM
  5399. PURPOSE
  5400. Loads a form from disk and displays it in the database window.
  5401.  
  5402. SYNTAX
  5403. OPEN FORM form
  5404.  
  5405. COMMENTS
  5406.  
  5407. form must be a string expression giving the file name of a form. Superbase
  5408. will also open any database files associated with the form.
  5409.  
  5410. EXAMPLES
  5411.  
  5412. 1    OPEN FORM "Invoice"
  5413.  
  5414. OPEN FIELDS
  5415. PURPOSE
  5416. Specifies which fields are displayed.
  5417.  
  5418. SYNTAX
  5419. OPEN FIELDS [FILE sbfname] fieldlist
  5420.  
  5421.                 5-104
  5422.  
  5423. COMMENTS
  5424.  
  5425. This command is the program equivalent of the Open Fields option on the
  5426. Project Menu. fieldlist consists of the list of fields required to be open.
  5427. To remove any restrictions on which fields are shown, use the CLOSE FIELDS
  5428. command.
  5429.  
  5430. EXAMPLES
  5431.  
  5432. 1    OPEN FIELDS FILE "Address" Firstname, Lastname, Country, City
  5433.  
  5434. OPEN FILE
  5435. PURPOSE
  5436. Opens a database file and its default index.
  5437.  
  5438. SYNTAX
  5439. OPEN FILE sbfname [; password]
  5440.  
  5441. COMMENTS
  5442.  
  5443. Note the distinction between OPEN FILE "aaa" which opens a database file,
  5444. and OPEN "aaa" (FOR INPUT) which opens a text file. sbfname is compulsory,
  5445. and if a password is required to access the file, then it is also
  5446. compulsory (use a semicolon to separate the filename from the password).
  5447. INDEX followed by a field name may be added to the end of an OPEN FILE
  5448. command,  allowing you to select an index other than the default index. But
  5449. it can only be used if the file has already been opened by a direct command
  5450. or an earlier program line. As explained in the entry for the INDEX
  5451. command, DML parses the whole line before executing it; so if you refer to a
  5452. field, it must be a field in a file that already been opened. Otherwise an
  5453. error will result.
  5454.  
  5455. EXAMPLES
  5456.  
  5457. 1    OPEN FILE "aaa"
  5458. 2    x$="bbb": OPEN FILE x$
  5459.  
  5460.                 5-105
  5461.  
  5462. 3     OPEN FILE "aaa"; "John"
  5463.  
  5464. NOTES
  5465. In example 3, 'John' is the password for the file 'aaa'.
  5466.  
  5467. ORDER
  5468. PURPOSE
  5469. Sets the order for Query output.
  5470.  
  5471. SYNTAX
  5472. ORDER [&nexpr]field[ASCENDING/DESCENDING] [, field]
  5473.                 ASCENDING/DESCENDING] [, .....]
  5474.  
  5475. COMMENTS
  5476.  
  5477. ORDER is a Query Language command and can only be entered in a query
  5478. section - i.e., it works in conjunction with the Query Language command
  5479. Select. This command is the program equivalent of the Order command line in
  5480. the query definition dialog: it takes the same syntax and serves the same
  5481. purpose. The field specified with the ORDER command determines the order in
  5482. which the field in the SELECT line are output. If you are familiar with the
  5483. concept of sorting,  you can think of ORDER as setting the sort 'key' for
  5484. query output. field must be a field in an open file, but it does not need
  5485. to be an indexed field; nor does it have to be one of the fields in the
  5486. SELECT line. ASCENDING and DESCENDING allow you to specify whether data is
  5487. sorted in ascending or descending order. If you specify a text field with
  5488. the ORDER command - i.e., if you specify it as the sort key-Superbase
  5489. outputs record data according to the alphabetical order of the sort field.
  5490. DESCENDING reverses the order and sorts the field from Z to A. With
  5491. numeric, date and time fields, ASCENDING sorts data in numeric, date or
  5492. time order; and DESCENDING reverses the order. By default, fields are sorted
  5493. in ascending order; so it not strictly necessary to include the ASCENDING
  5494. parameter. You can also specify more than one field in the ORDER line,
  5495. separating each with a comma. If enter two fields, the first field takes
  5496. precedence as a sort key
  5497.  
  5498.                 5-106
  5499.  
  5500. over the second field; i.e., records are first sorted according to the first
  5501. field, and then any duplicate data items are sorted according to the second
  5502. key. The same applies if there are more than two fields: the second key has
  5503. priority over the third, the third has over the fourth, and so on.
  5504.  
  5505. EXAMPLES
  5506.  
  5507. The examples illustrate how ORDER works by taking a limited set of records
  5508. and showing some of the different ways in which they may be sorted. Each
  5509. record contains data from three fields, Firstname, Lastname, and Country.
  5510.  
  5511. 1    SELECT Firstname, Lastname, Country
  5512.     ORDER Lastname
  5513.  
  5514. This examples takes Lastname as the sort key and produces the following
  5515. output:
  5516.  
  5517. FIRSTNAME        LASTNAME        COUNTRY
  5518. Pierre            Arnauld            France
  5519. William            Carter            USA
  5520. Gerde            Hemrich            West Germany
  5521. John            Miles            England
  5522. Anne            Richardson        USA
  5523. Peter            Smith            England
  5524. Robert            Brown            England
  5525.  
  5526. 2    SELECT Firstname, Lastname, Country
  5527.     ORDER Country
  5528. The output from this query would be as follows:
  5529.  
  5530. FIRSTNAME        LASTNAME        COUNTRY
  5531. Robert            Brown            England
  5532. John            Miles            England
  5533. Peter            Smith            England
  5534. Pierre            Arnauld            France
  5535. William            Carter            USA
  5536. Anne            Richardson        USA
  5537. Gerde            Hemrich            West Germany
  5538.  
  5539.                 5-107
  5540.  
  5541. 3    SELECT Firstname, Lastname
  5542.     ORDER Country DESCENDING, Lastname ASCENDING
  5543. The output from this query is:
  5544.  
  5545. FIRSTNAME        LASTNAME
  5546. Gerde            Hemrich
  5547. William            Carter
  5548. Anne            Richardson
  5549. Pierre            Arnauld
  5550. Robert            Brown
  5551. John            Miles
  5552. Peter            Smith
  5553.  
  5554. 4    SELECT Firstname, Lastname, Country
  5555.     ORDER Country, Firstname
  5556.  
  5557. This example uses Country as the primary sort key and Firstname as the
  5558. secondary key to produce the following output:
  5559.  
  5560. FIRSTNAME        LASTNAME        COUNTRY
  5561. John            Miles            England
  5562. Peter            Smith            England
  5563. Robert            Brown            England
  5564. Pierre            Arnauld            France
  5565. Anne            Richardson        USA
  5566. William            Carter            USA
  5567. Gerde            Hemrich            West Germany
  5568.  
  5569. NOTES
  5570.  
  5571. The default length for sorting is 15 characters per field. Superbase gives
  5572. equal weighing to upper case, lower case and accented instances of
  5573. characters. The & character followed by a value up to the length of the
  5574. field may precede any field, specifying the number of characters that will
  5575. be used in sorting.
  5576.  
  5577.                 5-108
  5578.  
  5579. OUTPUT TO
  5580. PURPOSE
  5581. Opens a text file on disk for output.
  5582.  
  5583. SYNTAX
  5584. OUTPUT TO filename
  5585.  
  5586. COMMENTS
  5587.  
  5588. This command makes the disk the current output device and sends any future
  5589. output to filename. It has the same effect as OPEN filename FOR OUTPUT. If
  5590. the text file already exists on disk, any output command issued after
  5591. OUTPUT TO, will overwrite the file. If you want to add data to an existing
  5592. text file,  use OPEN filename FOR APPEND.
  5593.  
  5594. EXAMPLES
  5595.  
  5596. 1    OUTPUT TO "Names"
  5597.     ? Lastname
  5598.     CLOSE OUTPUT
  5599. 2    OUTPUT TO a$
  5600.  
  5601. NOTES Example 1 stores the contents of the Lastname field (in the current
  5602. record) on disk in the text file Names.
  5603.  
  5604.                 5-109
  5605.  
  5606. PASSWORD
  5607. PURPOSE
  5608. Sets new password (or none) for a specified file.
  5609.  
  5610. SYNTAX
  5611. PASSWORD sbfname [; passwords]
  5612.  
  5613. COMMENTS
  5614.  
  5615. sbfname must be an open file and, as usual with filenames, must be included
  5616. in quotation marks. If no password is given, the existing password for the
  5617. specified file is removed.
  5618.  
  5619. EXAMPLES
  5620.  
  5621. 1    OPEN FILE "aaa; John"
  5622.     PASSWORD "aaa"
  5623. Removes passwords.
  5624. 2    PASSWORD "aaa; Rosebud"
  5625. Sets a password for the file 'aaa'.
  5626. 3    OPEN FILE "aaa; John"
  5627.     PASSWORD "aaa; John; Paul; George"
  5628. Adds passwords for read/write and read only access privileges.
  5629.  
  5630. PCOL
  5631. PURPOSE
  5632.  
  5633. Return the column position of the print head on the current output printer
  5634. or resets the print head's position.
  5635.  
  5636. SYNTAX
  5637. PCOL (nexpr)
  5638.  
  5639. COMMENTS
  5640.  
  5641. If nexpr is zero, the function returns the column position of the print
  5642. head
  5643.  
  5644.                 5-110
  5645.  
  5646. on the current printer. For the Row position, see PROW. See also LOCATE.
  5647. You can also use this function to set the counter Superbase uses to keep
  5648. track of the print head's position. Giving nexpr a positive value, sets the
  5649. counter to that value. The print head itself is not moved. This feature is
  5650. used to reset the internal count after issuing a series of printer commands
  5651. which have not in fact moved the print head, for example, after switching
  5652. to high density graphics mode.
  5653.  
  5654. EXAMPLES
  5655.  
  5656. 1    x%=PCOL (0)
  5657. 2    ? PCOL (0)
  5658.  
  5659. POSITION
  5660. PURPOSE
  5661. Sets the data pointer to a new position in an ASCII file.
  5662.  
  5663. SYNTAX
  5664. POSITION nexp
  5665.  
  5666. COMMENTS
  5667.  
  5668. When you read data from an ASCII file on disk, Superbase uses an internal
  5669. pointer to keep track of it. The OPEN file FOR INPUT command sets the
  5670. pointer to zero, the position of the first character in the file.
  5671. Thereafter it is incremented by one for each character that is input using
  5672. the INPUT command. POSITION sets the pointer to the character position
  5673. specified by nexpr. Normally, the data in an ASCII file is read into the
  5674. computer sequentially. With Position, you can input character data on a
  5675. more selective basis. You will only be able to take advantage of this
  5676. command if you know where the data is stored in a file. Superbase stores
  5677. data in variable length fields (as opposed to fixed length fields): when
  5678. you create an ASCII file from an '.sbf' file by exporting it, the amount of
  5679. space occupied on disk by field data may vary from record to record. This
  5680. means that there is no simple way of knowing the position of any particular
  5681. field or record. One solution to this problem is to create an ASCII file
  5682. from a database file using the query option Output to Disk. When you do
  5683. this, Superbase stores
  5684.  
  5685.                 5-111
  5686.  
  5687. the data in fixed length fields-each field takes the length set in the file
  5688. definition. You can then work out the number of characters occupied by a
  5689. record in the ASCII and use this figure to retrieve specific records or
  5690. fields. For example, if the record length was 49 characters, you would
  5691. enter:
  5692.  
  5693.     POSITION 49 * 5 + 1: INPUT LINE a$
  5694.  
  5695. to retrieve the fifth record in the file (you need to add one because the first
  5696. character position is zero).
  5697.  
  5698. EXAMPLES
  5699.  
  5700. 1    OPEN "Cust.asc" FOR INPUT
  5701.     FOR n%=0 to 76 * 12 STEP 77
  5702.     POSITION n%
  5703.     INPUT & 15, a$
  5704.     ? a$
  5705.     NEXT
  5706.     CLOSE INPUT
  5707.  
  5708. NOTES
  5709.  
  5710. This example inputs the first field from the first twelve records in the
  5711. ASCII file Cust.asc. It assumes that the record length is 77 characters and
  5712. that the length of the first field is 15 characters.
  5713.  
  5714. PRINT
  5715. PURPOSE
  5716. Sends information to the printer.
  5717.  
  5718. SYNTAX
  5719. PRINT[expressionlist]
  5720.  
  5721. COMMENT
  5722.  
  5723. PRINT, followed by a semicolon and nothing else, selects the printer as the
  5724. current output device. The ? command can then be used to send information
  5725. to the printer. You can also use PRINT to output information directly to
  5726. the printer, by following the command with one or more expressions. But
  5727. note that any use of PRINT makes the printer the current output device. The
  5728. items in the expression list following the Print command may be separated
  5729. by a semicolon or a comma. If a semicolon is used, Superbase will print the
  5730.  
  5731.                 5-112
  5732.  
  5733. expressions one after the another without any spaces in between; a comma has
  5734. the effect of inserting a space between items. In some circumstances, you
  5735. may also dispense with separators altogether. Thus, provided it can
  5736. distinguish between different items, Superbase will accept a list of
  5737. expressions which are entered on the line head to tail; for example:
  5738.  
  5739.     PRINT a$b$c%"Hello"
  5740.  
  5741. EXAMPLES
  5742.  
  5743. 1    PRINT;
  5744.     ? MEMORY
  5745.     DISPLAY;
  5746. 2    PRINT BF "The items in the following list will be printed in bold
  5747.                   face"
  5748.     PRINT "One", "Two", "Three"; CHR$ (12)
  5749.     DISPLAY;
  5750.  
  5751. NOTES
  5752.  
  5753. The first example prints the current program's variables and their
  5754. contents. Example 2 prints a list of items, and then sends the form feed
  5755. character - CHR$ (12) -to the printer. Both examples use the DISPLAY
  5756. command to make the screen the current output device after the print
  5757. operation is finished.
  5758.  
  5759.                 5-113
  5760.  
  5761. PROTECT
  5762. PURPOSE
  5763. Saves the current program in an encrypted form.
  5764.  
  5765. SYNTAX
  5766. PROTECT filename
  5767.  
  5768. COMMENTS
  5769.  
  5770. Use this command to ensure that program files are not seen by anyone else.
  5771. It stores a file on disk in an encrypted (scrambled) form so that it can be
  5772. run but not edited. If the first line of a program is a REM statement,
  5773. PROTECT displays that line,  but hides the rest of the program from any
  5774. attempt to edit or LIST it.
  5775.  
  5776. EXAMPLES
  5777.  
  5778. 1    PROTECT "myprog"
  5779.  
  5780. PROW
  5781. PURPOSE
  5782. Returns the row position of the print head on the current output printer.
  5783.  
  5784. SYNTAX
  5785. PROW (nexpr)
  5786.  
  5787. COMMENTS
  5788.  
  5789. If nexpr is zero, the function returns the row position of the print head
  5790. on the current printer. For the Column position, see PCOL. See also LOCATE.
  5791. Giving nexpr a positive value resets Superbase's internal row counter. See
  5792. PCOL.
  5793.  
  5794. EXAMPLES
  5795.  
  5796. 1    x%=PROW (0)
  5797. 2    ? PROW (0)
  5798.  
  5799.                 5-114
  5800.  
  5801. QUIT
  5802. PURPOSE
  5803. Exits from Superbase.
  5804.  
  5805. SYNTAX
  5806. QUIT
  5807.  
  5808. COMMENTS
  5809.  
  5810. This has same effect as selecting the Quit option from the Project menu. It
  5811. exits from Superbase and returns the user to the desktop interface.
  5812.  
  5813.                 5-115
  5814.  
  5815. READ
  5816. PURPOSE
  5817. Reads the data given in a DATA statement and assigns it to a variable or
  5818. field.
  5819.  
  5820. SYNTAX
  5821. READ var/field[, var/field] [, .....]
  5822.  
  5823. COMMENT
  5824.  
  5825. The types of variables or fields used with a READ command must match the
  5826. types of data expected-numeric variables or numeric fields for numeric data
  5827. and string variables or string fields for string data. DML uses a pointer
  5828. to keep track of where it is in the list of DATA items; that is, each time a
  5829. data item is read, DML moves the pointer on to the next item in the list.
  5830. If you wish to read the same data again, you can place a label in front of
  5831. a DATA statement and use RESTORE.
  5832.  
  5833. EXAMPLES
  5834.  
  5835. 1    READ a%, b$, fielda.filea, fielda.fileb
  5836.  
  5837. RECCOUNT
  5838. PURPOSE
  5839. Counts the number of records in a file.
  5840.  
  5841. SYNTAX
  5842. RECCOUNT (sbfname)
  5843.  
  5844. COMMENTS
  5845.  
  5846. This function returns a number showing how many records there are in the
  5847. file specified. You can use the empty string as an argument-RECCOUNT ("")
  5848. -to refer to the current file.
  5849.  
  5850. EXAMPLES
  5851.  
  5852. 1    ? RECCOUNT ("Orders")
  5853.  
  5854.                 5-116
  5855.  
  5856. 2    x%=RECCOUNT (x$)
  5857. 3    OPEN FILE ("address")
  5858.     SELECT FIRST
  5859.     FOR n%=1 to RECCOUNT ("address")
  5860.     VIEW
  5861.     SELECT NEXT
  5862.     NEXT n%
  5863.  
  5864. NOTES
  5865. Example 3 displays all the records in the file "address" in turn.
  5866.  
  5867. REM
  5868. PURPOSE
  5869. Inserts a non-executable comment (a remark) into a program.
  5870.  
  5871. SYNTAX
  5872. REM[text]
  5873.  
  5874. COMMENTS
  5875.  
  5876. REM has the effect of cancelling any statements after it. This makes it
  5877. useful when you are testing a program-placing it at the start of a
  5878. multi-statement line puts the following statements temporarily out of
  5879. action. More generally,  use REM to annotate a program in order to explain
  5880. how it works or what it does. A single quotation mark after a command
  5881. without an intervening colon also acts as a REM statement.
  5882.  
  5883. EXAMPLES
  5884.  
  5885. 1    REM this is a remark
  5886. 2    ....: FILE "aaa" open aaa
  5887. 3    ....: FILE "aaa": REM open aaa
  5888. 4    FILE "aaa": REM eliminate next commands: INDEX abc: SELECT 
  5889.     FIRST
  5890.  
  5891.                 5-117
  5892.  
  5893. NOTES
  5894.  
  5895. Examples 2 and 3 have identical effects and demonstrate the two different
  5896. ways of entering a comment. In example 4, the REM statement means that the
  5897. INDEX and SELECT FIRST commands are not executed.
  5898.  
  5899. REMOVE FILE
  5900. PURPOSE
  5901. Removes a database file from disk, along with its associated definition and
  5902. index files.
  5903.  
  5904. SYNTAX
  5905. REMOVE sbfname
  5906.  
  5907. COMMENT
  5908.  
  5909. This command operates in the same way as the Remove File menu option. Note
  5910. that you are not asked for confirmation-the file is just removed.
  5911.  
  5912. EXAMPLES
  5913.  
  5914. 1    REMOVE FILE "aaa"
  5915. 2    REMOVE FILE "DF1: aaa"
  5916. 3    REMOVE FILE "GEM\SBASE\aaa"
  5917.  
  5918. REMOVE FROM
  5919. PURPOSE
  5920. Removes records which match the conditions specified.
  5921.  
  5922. SYNTAX
  5923. REMOVE FROM FILE sbfname[WHERE conditions]
  5924.  
  5925. COMMENTS
  5926.  
  5927. This command works in the same way as the equivalent PROJECT-REMOVE-FILE
  5928. menu option. It deletes records from a file on disk.
  5929.  
  5930.                 5-118
  5931.  
  5932. FILE sbfname has to be open, and if the file requires a password, you must
  5933. have full access to it.
  5934.  
  5935. WHERE conditions is optional and is set up in the same way as a filter. If
  5936. it is not included, the command acts on all the records in a file.
  5937.  
  5938. EXAMPLES
  5939.  
  5940. 1    REMOVE FROM FILE "aaa" WHERE Lastname LIKE "[a-c]*"
  5941. 2    REMOVE FROM FILE "aaa"
  5942. This empties the file of all its data.
  5943.  
  5944. REMOVE INDEX
  5945. PURPOSE
  5946. Removes an index on the current file from disk.
  5947.  
  5948. SYNTAX
  5949. REMOVE INDEX index
  5950.  
  5951. COMMENT
  5952.  
  5953. This command works in the same way as the Remove Index option on the
  5954. Project menu. The file must be open, and, if it requires a password, you
  5955. must have full access privileges. index is the name of an indexed field. It
  5956. can be entered with a file extension.
  5957.  
  5958. EXAMPLES
  5959.  
  5960. 1    REMOVE fielda
  5961. 2    REMOVE fieldb.aaa
  5962.  
  5963.                 5-119
  5964.  
  5965. RENAME
  5966. PURPOSE
  5967. Renames a file on disk.
  5968.  
  5969. SYNTAX
  5970. RENAME old.filename[, /TO]new.filename
  5971.  
  5972. COMMENT
  5973.  
  5974. This command works in the same way as the RENAME command in MS DOS or Amiga
  5975. DOS, but allows you to rename a file without exiting from Superbase. You
  5976. have the option of using either a comma or the keyword TO as the separator
  5977. between the two file names.
  5978.  
  5979. EXAMPLES
  5980.  
  5981. 1    RENAME "aaa", "bbb"
  5982. 2    RENAME "aaa" TO "bbb"
  5983.  
  5984. REORGANIZE
  5985. PURPOSE
  5986. Reorganizes the current file or a specified file.
  5987.  
  5988. SYNTAX
  5989. REORGANIZE [FILE sbfname] [TO]sbfnameb
  5990.  
  5991. COMMENTS
  5992.  
  5993. This command is the program equivalent of the Reorganize option on the
  5994. System menu (see Chapter 8, Volume 1). It takes a file on disk, reorganizes
  5995. it, and stores it as sbfnameb. IF the FILE option is not used, the current
  5996. file is reorganized. sbfnameb can include the pathname for another
  5997. directory or disk. If you enter a pathname without a file name following
  5998. it, the file will be reorganized under the same name.
  5999.  
  6000.                 5-120
  6001.  
  6002. Note that you cannot reorganize a file under the same name in the same
  6003. directory; i.e. if a pathname is not supplied, sbfnameb must not be the same
  6004. as sbfnamea.
  6005.  
  6006. EXAMPLES
  6007.  
  6008. 1    FILE "aaa": REORGANIZE TO "copy"
  6009. 2    REORGANIZE "aaa" TO "a: mydir\"
  6010. 3    REORGANIZE "aaa" TO "DF1: Mydir/"
  6011. Example 1 creates a reorganized file 'copy' in the current directory,
  6012. Example 2 creates a reorganized file 'aaa' in directory mydir on the disk
  6013. in drive a (or,  in example 3, drive DF1 on the Amiga).
  6014.  
  6015. REPLICATE
  6016. PURPOSE
  6017. Replicates a character a given number of times.
  6018.  
  6019. SYNTAX
  6020. REPLICATE (strexp, nexp)
  6021.  
  6022. COMMENTS
  6023.  
  6024. REPLICATE repeats the character in strexpr the number of times given in
  6025. nexp.
  6026.  
  6027. EXAMPLES
  6028.  
  6029. 1    textfieldc=REPLICATE ("*", 10)
  6030. 2    x$=REPLICATE (textfieldc, 4)
  6031. 3    x$=REPLICATE (MID$ (x$, 4, 2), 6)
  6032. 4    x$=REPLICATE  (" ", 25)
  6033.  
  6034. NOTES
  6035. Example 4 fills x$ with 25 spaces, but see function SPACE$.
  6036.  
  6037.                 5-121
  6038.  
  6039. REPORT
  6040. PURPOSE
  6041. Specifies the field or fields on which totals (and other report statistics)
  6042. will be produced for the report as a whole.
  6043.  
  6044. SYNTAX
  6045. REPORT [SUMMARIZE] [params]fieldname[, fieldname][, ....]
  6046.  
  6047. COMMENT
  6048.  
  6049. Report has two uses. When you create a Report with the Forms Editor,
  6050. Superbase generates a Report statement by noting the fields which have been
  6051. specified in an AFTER REPORT section; i.e., if the AFTER REPORT section in a
  6052. Report program contains the statements:
  6053.  
  6054.     ? SUM amount
  6055.     ? COUNT deposits
  6056.  
  6057. Superbase will generate the following line in the program:
  6058.  
  6059.     REPORT amount, deposits
  6060.  
  6061. If you are writing a Report program yourself (as opposed to modifying a
  6062. program generated by Superbase), you should remember to enter a Report
  6063. statement including the names of any fields for which you wish totals and
  6064. other report statistics to appear. The second application for REPORT is a
  6065. query language command. In this context,  it allows you to create a program
  6066. line which is equivalent to the REPORT command line in the query definition
  6067. dialog. REPORT is used here to specify the fields for which totals and
  6068. other statistical. When you use the SUMMARIZE option, Superbase suppresses
  6069. the main detail of the report and prints just the summary information.
  6070.  
  6071.                 5-122
  6072.  
  6073. REQUEST
  6074. PURPOSE
  6075. Displays a Superbase dialog.
  6076.  
  6077. SYNTAX
  6078. REQUEST text1, text2, type[, nvar[, strvar[, len]]]
  6079.  
  6080. COMMENT
  6081.  
  6082. REQUEST allows you to select one of Superbase's dialogs and display it on
  6083. screen. To some extent you can also customize a dialog to your own
  6084. requirements. Thus you can place a title in box, and you can specify the
  6085. text string that initially appears in the dialog's command line or
  6086. selection box. For certain dialogs, it also possible to specify the length
  6087. of the box. text 1 and text2 are the first and second line of the dialog
  6088. title. They must be included although they can be "". The maximum length
  6089. for each line is 50 characters. type is the dialog type. It defines the
  6090. type of dialog according to the table shown below. nvar is a numeric
  6091. variable. It returns a value of 1 if OK is selected and there is an entry
  6092. into the string dialog. If CANCEL is selected or there is no entry into the
  6093. string dialog, it returns 0. strvar can be used with dialogs which have a
  6094. string entry box and has two functions: It is used to place a default value
  6095. into the string box, i.e., the text string in strvar is entered into the
  6096. string box when the dialog is displayed. It returns the string which the
  6097. user enters in the box. len specifies the length of the string box (where
  6098. appropriate). This is particularly useful for the information dialogs. For
  6099. dialog types 5-16 it is not need as Superbase sets the box to the maximum
  6100. file name length of 50 characters. For dialog type 4 len must be specified.
  6101.  
  6102.                 5-123
  6103.  
  6104. Types of Dialogs available:
  6105.  
  6106. TYPE    DIALOG            BUTTONS
  6107. 0    string            OK
  6108. 1    string            OK CANCEL
  6109. 2    string            OK
  6110. 3    string            OK CANCEL
  6111. 4    string            OK CLEAR CANCEL
  6112. 5    Database Files        OK CLEAR CANCEL
  6113. 6    Open Fields List    OK CLEAR CANCEL
  6114. 7    Indexed fields        OK CLEAR CANCEL
  6115. 8    Non indexed fields    OK CLEAR CANCEL
  6116. 9    Field Info        OK CLEAR CANCEL 
  6117. 10    Open Database Files    OK CLEAR CANCEL
  6118. 11    Database Files        OK CLEAR CANCEL
  6119. 12    Program Files        OK CLEAR CANCEL
  6120. 13    Text Files        OK CLEAR CANCEL
  6121. 14    Query Files        OK CLEAR CANCEL
  6122. 15    Update Files        OK CLEAR CANCEL
  6123. 16    Function Key Files    OK CLEAR CANCEL
  6124. 17    Directory listing    OK CLEAR CANCEL
  6125. 18    Subdirectory List    OK CLEAR CANCEL
  6126.  
  6127. Note that a database file must be open before dialogs 5 to 9 can be
  6128. selected.
  6129.  
  6130. EXAMPLES
  6131.  
  6132. 1    REQUEST "", "", 2, 
  6133. 2    a%=0:a$="":REM initialize nvar and strvar
  6134.     REQUEST "Select a program", "", 5, a%, a$, 32
  6135.     IF a%=0 THEN ? "OK so you do not want to run a program":END
  6136.     CHAIN a$
  6137. 3    a%=0:a$=":OPEN FILE "aaa"
  6138.     REQUEST "Select an Index", "", 7, a%, a$
  6139.     IF a%=0 THEN END
  6140.     INDEX a$
  6141.     lablook:a$="":REQUEST "Enter a key", "", 1, a%, a$, 15
  6142.     IF a%=0 THEN END
  6143.     SELECT KEY a$
  6144.     IF FOUND  ("aaa") THEN GOTO lablook2
  6145.     REQUEST "No Record with key" + a$, "See Nearest ?", 1a%
  6146.  
  6147.                 5-124
  6148.  
  6149.     IF a%=0 THEN GOTO lablook
  6150.     lablook2:VIEW:WAIT FOR 5:GOTO lablook
  6151.  
  6152. NOTES
  6153.  
  6154. Example 1 puts an "OK" dialog up for 2 seconds. Example 2 allows the user
  6155. to select a program to run. Example 3 in essence duplicates the key lookup
  6156. function from the ? button on the Superbase Control Panel. Note the
  6157. concatenation of the first title line of the dialog on the third from last
  6158. line.
  6159.  
  6160. RESTORE
  6161. PURPOSE
  6162. Moves the data pointer back to the first DATA statement, or to a specified
  6163. label.
  6164.  
  6165. SYNTAX
  6166. RESTORE[label]
  6167.  
  6168. COMMENTS
  6169.  
  6170. The data pointer is the internal pointer that Superbase uses to keep track
  6171. of which DATA statements have been read. Initially it has a value of zero
  6172. and points to the first DATA statement. As you READ data into variables or
  6173. fields,  the data pointer is increased by one for every data item read.
  6174. This command resets the data pointer. If you do not specify label, the data
  6175. pointer is reset to the beginning of the first DATA statement. If you
  6176. specify label, the data pointer is reset to the data statement following
  6177. the label.
  6178.  
  6179. EXAMPLES
  6180.  
  6181. 1    RESTORE
  6182. 2    RESTORE datalabel1
  6183.  
  6184.                 5-125
  6185.  
  6186. RESUME
  6187. PURPOSE
  6188. Resumes execution after an error.
  6189.  
  6190. SYNTAX
  6191. RESUME[NEXT/label]
  6192.  
  6193. COMMENTS
  6194.  
  6195. The RESUME command works in conjunction with the ON ERROR GOTO command
  6196. which is used to trap program errors. RESUME, on its own, returns program
  6197. control to the statement that caused the error. When NEXT is included, the
  6198. statement returns program control to the statement after the one which
  6199. caused the error. label transfers program control to the label specified.
  6200.  
  6201. EXAMPLES
  6202.  
  6203. 1    REM Top of program
  6204.     ON ERROR GOTO errlab1
  6205.     SELECT FIRST:? fieldname
  6206.     .....
  6207.     .....
  6208.     errlab1: IF ERRNO=44 THEN OPEN FILE "aaa": REM file not open
  6209.     RESUME
  6210. 2    REM read data
  6211.     ON ERROR GOTO errlab2
  6212.     .....
  6213.     READ x$
  6214.     .....
  6215.     endread:.....
  6216.     .....
  6217.     .....
  6218.     errlab2: IF ERRNO=18 THEN RESUME endread: REM out of data
  6219.  
  6220.                 5-126
  6221.  
  6222. RETURN
  6223. PURPOSE
  6224. Returns from a subroutine.
  6225.  
  6226. SYNTAX
  6227. RETURN
  6228.  
  6229. COMMENTS
  6230.  
  6231. The RETURN command is used to mark the end of a subroutine. It instructs
  6232. the computer to transfer program control to the statement immediately
  6233. following the GOSUB or ON GOSUB statement which initially called the
  6234. subroutine. See GOSUB.
  6235.  
  6236. RIGHT$
  6237. PURPOSE
  6238. Extracts one or more characters from a text string or text field, starting
  6239. from the right-hand end of the string.
  6240.  
  6241. SYNTAX
  6242. RIGHT$ (strexpr, nexpr)
  6243.  
  6244. COMMENTS
  6245.  
  6246. This function starts at the right of a string given in strexpr and extracts
  6247. nexpr characters.
  6248.  
  6249. EXAMPLES
  6250.  
  6251. 1    textfieldc=RIGHT$ (textfielda, 10)
  6252. 2    textfieldc=LCASE$ (RIGHT$ (textfielda, 1))
  6253. 3    IF RIGHT$ (textfielda, 1) ="s" THEN....
  6254. 4    x$=RIGHT$ ("ABCD", 2)
  6255. 5    x$=RIGHT$ (x$, 4)
  6256.  
  6257.                 5-127
  6258.  
  6259. RND
  6260. PURPOSE
  6261. Returns a random number.
  6262.  
  6263. SYNTAX
  6264. RND (nexpr)
  6265.  
  6266. COMMENTS
  6267.  
  6268. What the function returns depends on the value of nexpr.
  6269. It nexpr is less than zero, the random number generator is reseeded. This
  6270. means that a new series of random numbers will be generated, completely
  6271. unrelated to the last series. It also allows you to generate the same
  6272. series again for testing purposes, by entering the same seed. If nexpr is
  6273. zero, the number returned is the same as the previous one. If nexpr is
  6274. positive, a new random number is generated. The random number returned is
  6275. in the range 0 to 1. Technically, it is never zero and never unity, but all
  6276. values between 0 and one will be randomly generated and the distribution of
  6277. numbers will be relatively flat.
  6278.  
  6279. EXAMPLES
  6280.  
  6281. 1    numfieldc=RND (numfielda)
  6282. 2    numfieldc=RND (2) * 12
  6283. 3    textfieldc=MID$ (x$, RND (2) * 6 + 1, RND (2) * 12 + 1)
  6284. 4    $x=RND ($y)
  6285. 5    ? RND ($x)
  6286.  
  6287.                 5-128
  6288.  
  6289. ROW
  6290. PURPOSE
  6291. Returns the row position of the cursor on the screen.
  6292.  
  6293. SYNTAX
  6294. ROW (0)
  6295.  
  6296. COMMENTS
  6297.  
  6298. This function shows how far down the screen the cursor is. For the column
  6299. position, see COL.
  6300.  
  6301. EXAMPLES
  6302.  
  6303. 1    x%=ROW (0)
  6304. 2    ? ROW (0)
  6305.  
  6306. NOTES
  6307. In practise, example 2 would be pointless, because it changes the position
  6308. of the cursor in the course of printing it.
  6309.  
  6310. RUN
  6311. PURPOSE
  6312. Executes a program from memory, or loads it from disk and then runs it.
  6313.  
  6314. SYNTAX
  6315. RUN[filename]
  6316.  
  6317. COMMENTS
  6318.  
  6319. This will run the program currently in memory when used as a command or as
  6320. a program statement without the filename option. If filename is used to
  6321. specify a program, Superbase loads the program from disk and then runs it.
  6322. If filename is specified, it must be a string variable or a string constant
  6323. in quotation marks.
  6324.  
  6325.                 5-129
  6326.  
  6327. SAVE
  6328. PURPOSE
  6329. Saves any of the following types of file: program, text, function key,
  6330. query, and update files.
  6331.  
  6332. SYNTAX
  6333. SAVE [TEXT/KEY/QUERY/UPDATE]filename[, TEXT]
  6334.  
  6335. COMMENTS
  6336.  
  6337. filename is required. Superbase detects files of different types as
  6338. follows:
  6339.  
  6340.     aaa.sbk is a saved function key set
  6341.     aaa.sbp is a saved program
  6342.     aaa.sbq is a saved query
  6343.     aaa.sbt is a saved document (text)
  6344.     aaa.sbu is a saved update
  6345.  
  6346. If none of the options TEXT, KEY, QUERY or UPDATE is used, Superbase
  6347. assumes that filename refers to an '.sbp' file and attempt to save a
  6348. program file. If you include TEXT as the last parameter, DML saves a
  6349. program file as a text file. Only one of the options, TEXT, KEY, QUERY or
  6350. UPDATE, can be used at a time.
  6351.  
  6352. SAVE FILE
  6353. PURPOSE
  6354. Saves the current file definition.
  6355.  
  6356. SYNTAX
  6357. SAVE FILE sbfname
  6358.  
  6359. COMMENTS
  6360.  
  6361. When you create a new file, you can use MAKE to save the file definition.
  6362. SAVE FILE, however, must be used after you have edited a file definition
  6363. with MODIFY.
  6364.  
  6365.                 5-130
  6366.  
  6367. SAY
  6368. PURPOSE
  6369. Converts a text string into speech, using the Amiga's speech synthesis
  6370. facility.
  6371.  
  6372. SYNTAX
  6373. SAY [USING parameters]exprlist
  6374.  
  6375. COMMENTS
  6376.  
  6377. SAY is only available on the Amiga. The parameters for the USING option are
  6378. in this order:
  6379.  
  6380.     Pitch, Inflection, Rate (wpm), Sex, Phonemic
  6381.  
  6382. The following table gives the range of each parameter and its default
  6383. value:
  6384.  
  6385. PARAMETER    RANGE        DEFAULT        NOTES
  6386. Pitch        65-320        110
  6387. Inflection    0-1        0        0 is expressive, 1 is
  6388.                                                   monotone
  6389. Rate in wpm    40-400        150
  6390. Sex        0-10        0        0 is male, 1 is female
  6391. Phonemic    0-1        0        0 translates to phonemes, 
  6392.                           1 assumes phonemes
  6393.  
  6394. SAY only works with string expressions. To hear an external sound field use
  6395. the SHOW command.
  6396.  
  6397. EXAMPLES
  6398.  
  6399. 1    OPEN FILE "Address"
  6400.     SELECT FIRST
  6401.     WHILE NOT EOF ("Address")
  6402.     SAY Forename; Lastname; "comes from"; City; Country
  6403.     SELECT NEXT
  6404.     WEND
  6405. 2    SAY USING 280, 1, 200, 1, 0"Hello there", USING 140, 1, 200, 0, 0
  6406.     "Well, hello there"
  6407.  
  6408.                 5-131
  6409.  
  6410. SCRDUMP
  6411. PURPOSE
  6412. Outputs a copy of the screen to the printer-carries out a screen dump.
  6413.  
  6414. SYNTAX
  6415. SCRDUMP
  6416.  
  6417. COMMENTS
  6418.  
  6419. Only available on the Amiga.
  6420.  
  6421. SECS
  6422. PURPOSE
  6423. Returns the numbers of seconds from a time field.
  6424.  
  6425. SYNTAX
  6426. SECS (nexpr)
  6427.  
  6428. COMMENTS
  6429.  
  6430. nexpr will usually contain a time in milliseconds (thousandths of a second)
  6431. from a time field or from the result of a TIMEVAL calculation.
  6432.  
  6433. EXAMPLES
  6434.  
  6435. 1    scnds%=SECS (timefield)
  6436. 2    scnds%=SECS (TIMEVAL ("10:22AM"))
  6437.  
  6438. SELECT COMMANDS
  6439.  
  6440. The following SELECT commands relate to Record selection:
  6441.  
  6442.     SELECT CURRENT
  6443.     SELECT DUPLICATE
  6444.     SELECT FIRST
  6445.     SELECT KEY
  6446.     SELECT LAST
  6447.     SELECT NEXT
  6448.  
  6449.                 5-132
  6450.  
  6451.     SELECT PREVIOUS
  6452.     SELECT REMOVE
  6453.     SELECT WHERE
  6454.  
  6455. SELECT commands can only be used on an open database file, although this
  6456. does not have to be the current file. These commands do not display records
  6457. on screen. To do this, you need to use VIEW. Similarly, although they can
  6458. be used with any open file, the SELECT commands do not automatically make
  6459. an open file the current file. For example, SELECT LAST selects the last
  6460. record in a file (on index) even if the file is not current. If the file is
  6461. current, executing the VIEW command will be enough to display the last
  6462. record. But with any other open file, you will also need to use the FILE
  6463. command (as opposed to the FILE parameter) before you can display the
  6464. record (FILE makes an open file the current file).
  6465.  
  6466. SELECT CURRENT
  6467. PURPOSE
  6468. Selects the current record.
  6469.  
  6470. SYNTAX
  6471. SELECT CURRENT [FILE sbfname] [INDEX index]
  6472.  
  6473. COMMENT
  6474.  
  6475. This command has the same effect as the Current Record button on the
  6476. Control Panel at the bottom of the screen. Use INDEX to select the current
  6477. record using a different index.
  6478.  
  6479.                 5-133
  6480.  
  6481. SELECT DUPLICATE
  6482. PURPOSE
  6483. Selects the next record with the same key.
  6484.  
  6485. SYNTAX
  6486. SELECT DUPLICATE [INDEX index]
  6487.  
  6488. COMMENTS
  6489.  
  6490. This command finds the next record with the same key as the current key.
  6491. The key is the field on which the file is currently indexed. If SELECT
  6492. DUPLICATE fails to find a record with the same key, the EOF function is set
  6493. to true.
  6494.  
  6495. 1    SELECT FIRST:VIEW:x%=1
  6496.     lab1:SELECT DUPLICATE
  6497.     IF NOT EOF ("aaa") THEN VIEW:x%=x% + 1:GOTO lab1
  6498.     ? "End of "; x%; "duplicates-strike key"
  6499.     lab2:SELECT PREVIOUS:SELECT NEXT:IF EOF ("aaa") THEN END
  6500.     CLS:VIEW:GOTO lab1
  6501.  
  6502. Example 1 displays duplicate entries on an index. In Table view, it shows a
  6503. set of records at a time.
  6504.  
  6505. SELECT FIRST
  6506. PURPOSE
  6507. Selects the first record in the current or specified index sequence.
  6508.  
  6509. SYNTAX
  6510. SELECT[FILE sbfname] [INDEX index]
  6511.  
  6512. COMMENTS
  6513.  
  6514. This command has the same effect as the First Record button on the Control
  6515. Panel. Use the INDEX parameter to alter the current index.
  6516.  
  6517. EXAMPLES
  6518.  
  6519. 1    SELECT FIRST
  6520.  
  6521.                 5-134
  6522.  
  6523. 2    SELECT FIRST "Stock" INDEX Prodcode
  6524.  
  6525. NOTES
  6526.  
  6527. Example 1 selects the first record in the current file according to the
  6528. current index. Example 2 selects the first record in the Stock file
  6529. according to the Prodcode index.
  6530.  
  6531. SELECT KEY
  6532. PURPOSE
  6533. Selects the first record with matching string.
  6534.  
  6535. SYNTAX
  6536. SELECT KEY string [FILE sbfname] [INDEX index]
  6537.  
  6538. COMMENTS
  6539.  
  6540. This command has the same effect as the Key Lookup button on the Control
  6541. Panel. It searches the file for the first record whose index field matches
  6542. the string specified. Unlike the other SELECT commands, this command does
  6543. not affect the EOF function,  but instead sets the FOUND Function (see the
  6544. example given for FOUND).
  6545.  
  6546. EXAMPLES
  6547.  
  6548. 1    SELECT KEY "Zollinger"
  6549.     VIEW
  6550. 2    SELECT KEY "Johnson" FILE "Customer" INDEX Lastname
  6551.     IF FOUND ("Customer") THEN FILE "Customer":VIEW
  6552.  
  6553. NOTES
  6554.  
  6555. Example 1 selects the record in the current file whose Lastname field
  6556. contains the name Zollinger. It assumes that the current file is indexed on
  6557. Lastname. The program in example 2 selects the record in the Customer file
  6558. whose Lastname field contains the name Johnson. The Customer file must have
  6559. already been opened, but it does not have to be the current file. If the
  6560. program finds a record with a matching key, it uses the FILE command to
  6561. make the Customer file current and then displays the record.
  6562.  
  6563.                 5-135
  6564.  
  6565. SELECT LAST
  6566. PURPOSE
  6567. Selects the last record in the current or specified index sequence.
  6568.  
  6569. SYNTAX
  6570. SELECT [FILE sbfname] [INDEX index]
  6571.  
  6572. COMMENTS
  6573.  
  6574. Has the same effect as the Last Record button on the Control Panel.
  6575.  
  6576. SELECT NEXT
  6577. PURPOSE
  6578. Selects the next record in the current or specified index sequence.
  6579.  
  6580. SYNTAX
  6581. SELECT NEXT [FILE sbfname] [INDEX index]
  6582.  
  6583. COMMENT
  6584.  
  6585. Has the same effect as the Next Record button on the Control Panel.
  6586.  
  6587. SELECT PREVIOUS
  6588. PURPOSE
  6589. Selects the previous record in the current or specified index sequence.
  6590.  
  6591. SYNTAX
  6592. [FILE sbfname] [INDEX index]
  6593.  
  6594. COMMENTS
  6595.  
  6596. This command has the same effect as the Previous button on the Control
  6597. Panel.
  6598.  
  6599.                 5-136
  6600.  
  6601. SELECT REMOVE
  6602. PURPOSE
  6603. Removes the current record in the current file or another open file.
  6604.  
  6605. SYNTAX
  6606. SELECT [FILE sbfname]
  6607.  
  6608. COMMENTS
  6609.  
  6610. This command has the same effect as the Remove option on the Record menu.
  6611.  
  6612. SELECT WHERE
  6613. PURPOSE
  6614.  
  6615. Selects first record that matches the filter conditions or removes the
  6616. filter.
  6617.  
  6618. SYNTAX
  6619. SELECT WHERE[[FILE sbfname] [conditions]]
  6620.  
  6621. COMMENTS
  6622.  
  6623. This command has the same effect as the Filter button on the Control Panel.
  6624. conditions is set up in the same way as the string gadget in the Filter
  6625. requestor. If not specified, the current filter conditions are cleared.
  6626. SELECT WHERE can only be used to set a single file filter. If you enter the
  6627. name of a field which also occurs in another open file, you should include
  6628. the file the file name as an extension. Otherwise, Superbase may assume you
  6629. are attempting to use this command in a multi-file operation, and will
  6630. issue the error message:
  6631.  
  6632.     Can't do this
  6633.     This Where statement must be single file
  6634.  
  6635. If you wish to set a multi-file filter - to select records whose field data
  6636. matches the data in another file - use the LOOKUP function or the query
  6637. language command WHERE.
  6638.  
  6639.                 5-137
  6640.  
  6641. EXAMPLE
  6642.  
  6643. 1    SELECT WHERE fielda LIKE "[a-c]"
  6644. 2    SELECT WHERE "Stock" fieldb LIKE "[a-c]"
  6645. 3    SELECT WHERE
  6646.  
  6647. NOTES
  6648.  
  6649. Once set, the Control Panel filters remains active until it is cleared.
  6650. Example 3 clears the filter which may have been set by a previous SELECT
  6651. WHERE command or by direct entry in the filter dialog.
  6652.  
  6653. QUERY LANGUAGE COMMANDS
  6654.  
  6655. DML's Query Language commands allow you to create a program which duplicates
  6656. a Superbase query. These commands are used in report programs created by
  6657. the Forms Editor; but they can also be used for any of the query
  6658. applications described in Chapter 11, Volume 1 - sorting records, creating
  6659. complex multi-file filters, merging files, and so on. In Superbase a query
  6660. is defined by the four command lines in the query definition dialog
  6661. (Chapter 5, Volume 1, introduces this dialog; Chapter 11 explains it in more
  6662. detail). These command lines can be reproduced in a program by using the
  6663. query language commands. SELECT is used to define the Fields command line;
  6664. REPORT defines the Report command line; WHERE corresponds to the FILTER
  6665. line; and ORDER is used for the Order line. You will find a explanation of
  6666. these commands under their respective keyword entries. Here, we will
  6667. describe how they work together to form a query section. A query section
  6668. must start with the SELECT command and it should end with END SELECT. Any
  6669. other query language commands are optional; you will include them according
  6670. to your requirements. Thus, if you wish to use a filter, you will include a
  6671. WHERE command within the query section.
  6672.  
  6673.                 5-138
  6674.  
  6675. Likewise, if you wish to use reporting functions such as SUM and COUNT, you
  6676. will need to insert a REPORT command after the SELECT command and before
  6677. END SELECT. You can think of REPORT, WHERE and ORDER as modifying the query
  6678. output which is specified with the SELECT command. When SELECT is used on
  6679. its own - to form a single line query section - it outputs data from each
  6680. record in a specified file (or files) in turn. For example:
  6681.  
  6682.     SELECT Lastname.Address, Country.Address:
  6683.     END SELECT
  6684.  
  6685. This outputs a line showing the contents of the fields Lastname and Country
  6686. for each of the records in the Address file. As such, SELECT works in the
  6687. same way as the ? command except that it acts on all the records in a file.
  6688. If you inserted TO PRINTER after Country.Address in the example above,
  6689. SELECT would output data to the printer. The TO device parameter provides
  6690. an equivalent to the Output options in the query definition dialog. You can
  6691. use to specify an output device other than the screen:the printer, an ASCII
  6692. file, or a new '.sbf' file.
  6693.  
  6694. A QUERY LANGUAGE EXAMPLE
  6695.  
  6696. Any query created with the query definition dialog can be reproduced under
  6697. program control. We can illustrate this by converting a query file (an
  6698. '.sbq' file) into a program, taking the Deptran file supplied with the
  6699. demonstration file disk as an example. Deptran can be displayed on screen
  6700. using the LIST option from the System menu. It looks like this:
  6701.  
  6702.     SB
  6703.     CLIENTS
  6704.     DEPOSITS
  6705.     Deposit Transaction Report
  6706.     ON "Clients" Firstname.Clients, Lastname.Clients, ON "Deposits"
  6707.     @24 Bank, Amount, Deposits
  6708.     REPORT SUM Amount COUNT GROUP Lastname.Clients SUM
  6709.     Amount
  6710.     Lastname.Clients=Lastname.Deposits
  6711.     Lastname.Clients
  6712.  
  6713. SB on the first line indicates that this is a Superbase Professional query
  6714. file as opposed to one created in Superbase Personal. The next two lines
  6715. contain the names of the database files which are associated with this
  6716. query. 'Deposit
  6717.  
  6718.                 5-139
  6719.  
  6720. Transaction Report' is the query title, and the remaining lines represent
  6721. the four query command lines. Before we can load this file into the Program
  6722. Editor, we need to change its name to Deptran.sbp. To do this, select COPY
  6723. from the System menu and, after selecting Deptran.sbq as the file to be
  6724. copied, enter then name Deptran.sbp. You can now load the file into the
  6725. Program Editor using the Program open option. Converting it to a program is
  6726. just a matter of deleting two lines and inserting keywords in the others.
  6727. Once you have made these changes, the program should look like this:
  6728.  
  6729.     OPEN FILES "CLIENTS"
  6730.     OPEN FILE "DEPOSITS"
  6731.     SELECT ON "Clients" Firstname.Clients, Lastname.Clients, ON
  6732.     "Deposits" @24 Bank, Amount, Deposits
  6733.     REPORT SUM Amount COUNT GROUP Lastname.Clients SUM
  6734.     Amount
  6735.     WHERE Lastname.Clients=Lastname.Deposits
  6736.     ORDER Lastname.Clients
  6737.  
  6738. Note that the report line is the same as in the query file and does not
  6739. need to be altered. If you now run this program, it will have the same
  6740. effect as running Deptran from the query definition dialog (by clicking on
  6741. OK).
  6742.  
  6743. SELECT
  6744. PURPOSE
  6745. Specifies which are to be output from a query.
  6746.  
  6747. SYNTAX
  6748. SELECT [params]fields[TO device]:[statements]:END SELECT
  6749.  
  6750. COMMENTS
  6751.  
  6752. SELECT is a Query Language command and can used on its own or with other
  6753. Query Language commands to form a query section. fields can be one or more
  6754. field names from one or multiple files.params can be any of the output
  6755. format parameters as listed in the section which describes the ? commands.
  6756.  
  6757.                 5-140
  6758.  
  6759. In addition, there are three format parameters which can only be used with
  6760. the SELECT command:ON file, AS heading and FIELD. The syntax and function
  6761. of these parameters in described in their respective sections in Chapter
  6762. 11, Volume 1. TO device specifies the device to which the query output will
  6763. be sent. If it is not included output is to the screen. The device options
  6764. are:
  6765.  
  6766.     TO PRINTER
  6767.  
  6768. Outputs to the printer.
  6769.  
  6770.     TO FILE file
  6771.  
  6772. Creates a new '.sbf' file on disk under the file name specified, using the
  6773. query output.
  6774.  
  6775.     TO file
  6776.  
  6777. Outputs to the ASCII file on disk specified by file.
  6778. statements can be other query language statements formed with the commands
  6779. REPORT, WHERE, and ORDER. END SELECT is used to indicate the end of a query
  6780. section. It is not always necessary to include END SELECT, but you must
  6781. provide Superbase with some indication of where the query section finishes
  6782. and where the rest of the program starts. Otherwise, the statements
  6783. following the last line in the query section will be interpreted as part of
  6784. a multi-line SELECT statement. As an alternative to END SELECT, you could
  6785. use a blank line.
  6786.  
  6787.                 5-141
  6788.  
  6789. SER
  6790. PURPOSE
  6791. Returns the total number of records that have been created in a file.
  6792.  
  6793. SYNTAX
  6794. SER (filename)
  6795.  
  6796. COMMENTS
  6797.  
  6798. You can use the SER function to assign a serial number to each record in a
  6799. file. To do this, you need to define a field which will hold the serial
  6800. number. It should be defined as a constant field and should have SER
  6801. ("filename") as its constant formula. When you create the first record, it
  6802. will be given the value 1. This value will then be incremented by one for
  6803. each record you add to the file. The difference between SER and RECCOUNT is
  6804. that SER gives the total number of records that have been created,
  6805. irrespective of whether they have been deleted later. RECCOUNT returns the
  6806. number of records currently in the file.
  6807.  
  6808. 1    ? SER ("Stock")
  6809. 2    BLANK
  6810.     Recno.Stock=SER ("STOCK")
  6811.     Price.Stock=14.95
  6812.     Description.Stock="Widget"
  6813.     STORE
  6814.  
  6815. SET
  6816. PURPOSE
  6817. Reads a text file and executes any commands in the file, or assigns
  6818. variables from a text file.
  6819.  
  6820. SYNTAX
  6821. SET filename
  6822.  
  6823. COMMENTS
  6824.  
  6825. This command reads in a text file and executes it as if it were a sequence
  6826. of
  6827.  
  6828.                 5-142
  6829.  
  6830. command. The file, therefore, must contain valid DML commands. If the file
  6831. holds a set of variables-which have previously been saved to disk by ?
  6832. MEMORY-the variable assignments are executed. This provides a way of
  6833. transferring variables between different programs when CHAIN is not
  6834. appropriate. For example, Program 'a' can set up variables for Program 'c',
  6835. but Program 'a' CHAINs to Program 'b'. Another application would be to
  6836. communicate variables between different programs which are run on different
  6837. days.
  6838.  
  6839. EXAMPLES
  6840.  
  6841. 1    ......
  6842.     process a
  6843.     ......
  6844.     OPEN "aaa" FOR OUTPUT:? MEMORY:CLOSE OUTPUT:DISPLAY
  6845.     another program
  6846.     SET "aaa"
  6847.     ......
  6848.     process b
  6849. 2    SET "abc"
  6850. 'abc' could be ASCII file which contains a set of function key assignments.
  6851.  
  6852.                 5-143
  6853.  
  6854. SET BUFFERS
  6855. PURPOSE
  6856. Sets the number of buffers Superbase uses as a disk cache.
  6857.  
  6858. SYNTAX
  6859. SET BUFFERS nexp
  6860.  
  6861. COMMENTS
  6862.  
  6863. Operates in the same way as the Buffers option in Set Menu Options, and
  6864. allocates 512 bytes memory space for each buffer. nexp can have a value
  6865. from 1 to 99.
  6866.  
  6867. EXAMPLES
  6868.  
  6869. 1    SET BUFFERS 24
  6870.  
  6871. SET PAGING
  6872. PURPOSE
  6873. Sets paging on or off.
  6874.  
  6875. SYNTAX
  6876. SET PAGING[ON/OFF]
  6877.  
  6878. COMMENTS
  6879.  
  6880. When used without ON/OFF, it acts as toggle and operates in the same way as
  6881. the SET-PAGING menu options. With ON or OFF, it sets paging accordingly.
  6882.  
  6883. EXAMPLES
  6884.  
  6885. 1    SET PAGING OFF
  6886.  
  6887.                 5-144
  6888.  
  6889. SET VIEW MODE
  6890. PURPOSE
  6891. Sets the view mode or switches between one of the view modes and a Form.
  6892.  
  6893. SYNTAX
  6894. SET [TABLE]/[FORM]/[RECORD]
  6895.  
  6896. COMMENTS
  6897.  
  6898. Works in the same way as the equivalent Set Menu option, except that it
  6899. does not automatically display a record (use VIEW). If a Form (as opposed
  6900. to Form view) is displayed, the SET command switches the Form off and
  6901. selects the specified view mode. The Form remains in memory and can be
  6902. switched on again by repeating the SET command for the same view mode. In
  6903. other words, when a Form has been opened, the SET command toggles the
  6904. current view mode on and off.
  6905.  
  6906. EXAMPLES
  6907.  
  6908. 1    SET FORM
  6909. 2    SET TABLE:VIEW
  6910.  
  6911. SGN
  6912. PURPOSE
  6913. Finds the sign of a number.
  6914.  
  6915. SYNTAX
  6916. SGN (nexpr)
  6917.  
  6918. COMMENTS
  6919.  
  6920. This function returns the positive value of 1 if nexpr is positive and
  6921. returns the negative value -1 if nexpr is negative.
  6922.  
  6923.                 5-145
  6924.  
  6925. EXAMPLES
  6926.  
  6927. 1    numfieldc=SGN (numfielda)
  6928. 2    IF SGN (datefielda-datefieldb) THEN GOTO lab1
  6929. 3    x%=SGN (y%)
  6930. 4    x%=SGN (y% * numfielda * (datefielda-datefieldb))
  6931. 5    x%=SGN (VAL (RIGHT$ (textfielda, 5)))
  6932. 6    ? SGN (x%)
  6933.  
  6934. NOTES
  6935. Example 2 tests whether datefieldb is later than datefielda
  6936.  
  6937. SHOW
  6938. PURPOSE
  6939. Shows an external file.
  6940.  
  6941. SYNTAX
  6942. SHOW [field]/[strexpr]
  6943.  
  6944. COMMENTS
  6945.  
  6946. SHOW is the program equivalent of the camera button at the bottom of the
  6947. screen. It displays a picture or text from an external file.field must be a
  6948. field which holds the name of the external file, but it does not have to be
  6949. a field in the current file:if you add a file name extension to the field
  6950. name,  you can display pictures using other open database files. As an
  6951. alternative to specifying an external field, strexpr allows you to specify
  6952. the name of an external file. When field or strexpr is not given, SHOW
  6953. removes the picture from the screen.
  6954.  
  6955.                 5-146
  6956.  
  6957. SIN
  6958. PURPOSE
  6959. Returns the sine of an angle measured in radians.
  6960.  
  6961. SYNTAX
  6962. SIN (nexpr)
  6963.  
  6964. COMMENTS
  6965.  
  6966. This function returns the sine of the angle in nexpr, where the angle is
  6967. measured in radians. To convert degrees to radians, multiply by 180/PI.
  6968.  
  6969. EXAMPLES
  6970.  
  6971. 1    numfieldc=SIN (numfielda)
  6972. 2    x%=SIN (y%)
  6973. 3    x%=SIN (VAL (x$))
  6974. 4    ? SIN (x%)
  6975.  
  6976. SPACE$
  6977. PURPOSE
  6978. Fills a string with a specified number of spaces.
  6979.  
  6980. SYNTAX
  6981. SPACE$ (nexpr)
  6982.  
  6983. COMMENTS
  6984.  
  6985. nexpr must be in the range 0 to 255.
  6986.  
  6987. EXAMPLES
  6988.  
  6989. 1    textfieldc=SPACE$ (10)
  6990. 2    x$=SPACE$ (4)
  6991.  
  6992.                 5-147
  6993.  
  6994. SQR
  6995. PURPOSE
  6996. Returns the square root of a number
  6997.  
  6998. SYNTAX
  6999. SQR (nexpr)
  7000.  
  7001. COMMENTS
  7002.  
  7003. The function returns the square root of the number specified by nexpr. If
  7004. nexpr is less than zero, the function returns the error message 'invalid
  7005. number'.
  7006.  
  7007. EXAMPLES
  7008.  
  7009. 1    numfieldc=SQR (numfielda)
  7010. 2    numfieldc=SQR (2 * numfielda)
  7011. 3    textfieldc=STR$ (SQR (VAL (x$)))
  7012. 4    x%=SQR (y%)
  7013.  
  7014. STORE
  7015. PURPOSE
  7016. Stores the current record in the current file or in the file specified.
  7017.  
  7018. SYNTAX
  7019. STORE[, 0/1/2] [FILE sbfname]
  7020.  
  7021. COMMENTS
  7022.  
  7023. This command stores the record in memory for the current file, or for the
  7024. file specified with sbfname. It is equivalent to the Save option on the
  7025. Record menu.
  7026.  
  7027.                 5-148
  7028.  
  7029. The numeric parameters - 0, 1 or 2 - allow you to specify whether the
  7030. record is stored in batch mode or in the normal way (see the section on
  7031. Batch in Chapter 5, Volume 1). STORE, 1 stores the current record in batch
  7032. mode. The time taken to save the record on disk will be reduced, but the
  7033. data will not yet be secure:if you suffer a power loss, you will lose any
  7034. record data which has been saved (in the current session) using this
  7035. option. Note that STORE, 1 only turns on batch mode for the current
  7036. record.STORE, 2 does not store a record but makes the file secure. Any
  7037. records that have been saved previously with the STORE, 1 command will now
  7038. be made safe on disk. You should always execute a STORE, 2 command after
  7039. storing records in batch mode. STORE, 0 is optional and is the same as
  7040. STORE on its own:Superbase makes each record secure as it is stored. If you
  7041. were to turn the computer off accidentally, the most you would lose would
  7042. be the data in memory.
  7043.  
  7044. EXAMPLES
  7045.  
  7046. 1    BLANK
  7047.     Firstname="John"
  7048.     Lastname="Roberts"
  7049.     Street="15 Richmond Way"
  7050.     ......
  7051.     ......
  7052.     ......
  7053.     STORE
  7054. 2    FOR n%=1 to 10
  7055.     BLANK
  7056.     Firstname=Recdata$ (n%, 1)
  7057.     Lastname=Recadata$ (n%, 2)
  7058.     Street=Recdata$ (n%, 3)
  7059.     ......
  7060.     ......
  7061.     ......
  7062.     STORE, 1
  7063.     NEXT
  7064.     STORE, 2
  7065.  
  7066.                 5-149
  7067.  
  7068. NOTES
  7069.  
  7070. The first example creates a new record and stores it in the normal way.
  7071. Example 2 creates ten new records, reading data into the fields for each
  7072. record from the array Recdata$ and storing them in batch mode. When all the
  7073. records have been stored, it makes the file secure with the STORE, 2
  7074. command.
  7075.  
  7076. STR$
  7077. PURPOSE
  7078. Returns the text equivalent of a numeric expression.
  7079.  
  7080. SYNTAX
  7081. STR$ (nexpr [[, nexpri [, nexprd]]/[, numeric-format-string]])
  7082.  
  7083. COMMENTS
  7084.  
  7085. STR$ converts data which is held in a numeric variable or numeric field
  7086. into a text string. nexpri specifies the number of integers before the
  7087. decimal point and should be set large enough to avoid overflow display.
  7088. nexprd specifies the number of integers after the decimal point. The
  7089. maximum numeric format in Superbase is a total of 13 integers, so nexpri
  7090. plus nexprd must be less than 14. As an alternative to using nexpri and
  7091. nexprd, you can specify the numeric format as a string (see NUMBASE). If
  7092. these parameters are not used, the default numeric format set by Numeric
  7093. Format on the Set menu or by the most recent use of NUMBASE will be taken.
  7094. The complementary function to STR$ is VAL.
  7095.  
  7096. EXAMPLES
  7097.  
  7098. 1    textfieldc=STR$ (numfielda)
  7099. 2    textfieldc-STR$ (numfielda, 5, 0)
  7100. 3    x$=STR$ (165.4444, "z999999.00")
  7101.  
  7102.                 5-150
  7103.  
  7104. TAN
  7105. PURPOSE
  7106. Returns the tangent of an angle measured in radians.
  7107.  
  7108. SYNTAX
  7109. TAN (nexpr)
  7110.  
  7111. COMMENTS
  7112.  
  7113. The function returns the tangent of the angle in nexpr measured in radians.
  7114. The complementary function of TAN is ATN.
  7115.  
  7116. EXAMPLES
  7117.  
  7118. 1    numfieldc=TAN (numfielda)
  7119. 2    x%=TAN (y%)
  7120. 3    x%=TAN (VAL (x$))
  7121. 4    ? TAN (x%)
  7122.  
  7123. THOUSECS
  7124. PURPOSE
  7125. Takes a numeric value and returns the number of thousandths of a second
  7126. left over after subtracting the number of seconds.
  7127.  
  7128. SYNTAX
  7129. THOUSECS (nexpr)
  7130.  
  7131. COMMENTS
  7132.  
  7133. nexpr will usually contain a time in milliseconds from a time field or the
  7134. result of a TIMEVAL calculation. THOUSECS returns the same result as nexpr
  7135. MOD 1000.
  7136.  
  7137. 1    x%=THOUSECS (timefield)
  7138.  
  7139.                 5-151
  7140.  
  7141. TIME$
  7142. PURPOSE
  7143.  
  7144. Returns the time in string format from a numeric value which gives the time
  7145. in thousandths of a second.
  7146.  
  7147. SYNTAX
  7148. TIME$ (nexpr [, timeformat])
  7149.  
  7150. COMMENTS
  7151.  
  7152. The second argument for this function, timeformat, allows you to specify
  7153. the format the time string will have. It must conform to the rules for
  7154. Superbase time formats given in the keyword entry for DATEBASE.
  7155.  
  7156. EXAMPLES
  7157.  
  7158. 1    x$=TIME$ (timefield)
  7159. 2    ? TIME$ (NOW, "hh:mm:ssam")
  7160.  
  7161. TIMEVAL
  7162. PURPOSE
  7163. Returns the value of a time string in thousandths of a second.
  7164.  
  7165. SYNTAX
  7166. TIMEVAL (strexpr)
  7167.  
  7168. COMMENTS
  7169.  
  7170. strexpr must contain the time in a valid time format. See the keyword entry
  7171. for DATEBASE for a list of acceptable time formats.
  7172.  
  7173. EXAMPLES
  7174.  
  7175. 1    t%=TIMEVAL ("10:22am")
  7176. 2    t%=TIMEVAL ("14:03:12.201")
  7177.  
  7178.                 5-152
  7179.  
  7180. TODAY
  7181. PURPOSE
  7182. Gives the system date.
  7183.  
  7184. SYNTAX
  7185. TODAY
  7186.  
  7187. COMMENTS
  7188.  
  7189. TODAY shows the date in the date format as set with Date Format option in
  7190. the Set menu, or as set by the DATEBASE command. If your computer has a
  7191. real-time clock or you have set the system date, TODAY gives the current
  7192. date. Otherwise,  it gives the default system date. TODAY holds the date as
  7193. a julian date number. Superbase automatically translates this into the
  7194. current date format when you display the date using ? TODAY.
  7195.  
  7196. EXAMPLES
  7197.  
  7198. 1    ? TODAY
  7199. 2    datefield=TODAY
  7200. 3    ? MONTH (TODAY)
  7201.  
  7202.                 5-153
  7203.  
  7204. TRIM$
  7205. PURPOSE
  7206. Trims trailing spaces from a string or a text field.
  7207.  
  7208. SYNTAX
  7209. TRIM$ (strexpr)
  7210.  
  7211. COMMENTS
  7212.  
  7213. This returns the string consisting of the original string specified by
  7214. strexpr with any trailing spaces eliminated.
  7215.  
  7216. EXAMPLES
  7217.  
  7218. 1    stringfieldc=TRIM$ (textfielda)
  7219. 2    x$=TRIM$ (textfieldc.filea)
  7220. 3    ? LEN (x$); LEN (TRIM$ (x$)
  7221.  
  7222. UCASE$
  7223. PURPOSE
  7224. Returns the upper case equivalent of a text string or a text field.
  7225.  
  7226. SYNTAX
  7227. UCASE$ (strexpr)
  7228.  
  7229. COMMENTS
  7230.  
  7231. UCASE$ returns the upper case equivalent of the lowercase alphabet; no other
  7232. characters, including those already in upper case, are affected. The
  7233. complementary function of UCASE$ is UCASE$.
  7234.  
  7235. EXAMPLES
  7236.  
  7237. 1    textfieldc=UCASE$ (textfielda)
  7238. 2    x$=UCASE$ (y$)
  7239.  
  7240.                 5-154
  7241.  
  7242. 3    x$=UCASE$ ("ABCDEF")
  7243.  
  7244. NOTES
  7245.  
  7246. If you wish to set the first letter of a string to upper case, leaving the
  7247. rest in lower case, you can so using the FCASE$ function.
  7248.  
  7249. UPDATE
  7250. PURPOSE
  7251. Performs a relational update.
  7252.  
  7253. SYNTAX
  7254. UPDATE[calclist] [WHERE conditions] [END UPDATE]
  7255.  
  7256. COMMENTS
  7257.  
  7258. UPDATE on its own runs the update in memory. This may have been loaded from
  7259. disk with the LOAD UPDATE command, or it may have been created in the same
  7260. session using the Process menu option Update Edit. By specifying calclist
  7261. and conditions, you can also use UPDATE to define an update and then run
  7262. it. calclist corresponds to command line set in the Update Fields
  7263. dialog; conditions corresponds to the filter which is set in the Update
  7264. Filter dialog. The first specifies how the records are updated, the second
  7265. specifies which records are to be updated. WHERE conditions and calclist
  7266. should be entered as separate statements, either on the same line as UPDATE
  7267. separated by colons, or on separate lines. They form part of an Update
  7268. program section, headed by the UPDATE command and ending with END UPDATE.
  7269. The END UPDATE command must be included if the Update section is followed
  7270. by other statements in a program. Otherwise Superbase will regard these as
  7271. belonging to the Update section. As an alternative to using this command,
  7272. you can terminate the section with a colon or a blank line. UPDATE is a
  7273. multi-file command, so both conditions and calclist can refer to more than
  7274. one file. In this case, the first condition in the update filter must
  7275. establish a join between two files.
  7276.  
  7277.                 5-155
  7278.  
  7279. EXAMPLES
  7280.  
  7281. 1    LOAD UPDATE "Newrate":UPDATE
  7282. Loads the Update file Newrate from disk, and then runs it.
  7283. 2    UPDATE
  7284.     Price.Orders=Price.Stock
  7285.     WHERE Product_Code.Orders=Product_Code.Stock AND
  7286.     Order_date "15 July 1987"
  7287.     END UPDATE
  7288. Updates prices in the Orders file on the basis of the price details in the
  7289. Stock file.
  7290.  
  7291. VAL
  7292. PURPOSE
  7293. Returns the numeric value of a text string.
  7294.  
  7295. SYNTAX
  7296. VAL (strexpr)
  7297.  
  7298. COMMENTS
  7299.  
  7300. The function returns the numeric value of the number (if any) in the
  7301. lefthand end of the string or substring specified in strexpr. In cases
  7302. where strexpr does not contain a number or where the leftmost character of
  7303. strexpr is not numeric,  the function returns 0. The complementary function
  7304. of VAL is STR$
  7305.  
  7306. EXAMPLES
  7307.  
  7308. 1    numfieldc=VAL (textfielda)
  7309. 2    numfieldc=VAL (RIGHT$ (textfielda, 8))
  7310. 3    VAL (textfielda) > 1 AND VAL (RIGHT$ (textfielda, 4) > 0
  7311. 4    x%=VAL ("12.45A456")
  7312. 5    x%=VAL (x$)
  7313.  
  7314.                 5-156
  7315.  
  7316. VIEW
  7317. PURPOSE
  7318. Displays the current record in the current file.
  7319.  
  7320. SYNTAX
  7321. VIEW
  7322.  
  7323. COMMENTS
  7324.  
  7325. Allows the user to see the current record in the current file in the view
  7326. format specified by the SET view mode command. It can also be used to
  7327. redisplay the current Form.
  7328.  
  7329. WAIT
  7330. PURPOSE
  7331. Waits for a specified time or until a key is pressed.
  7332.  
  7333. SYNTAX
  7334. WAIT [FOR time]/[FOR nexp] [var/field]
  7335.  
  7336. COMMENTS
  7337.  
  7338. Wait waits for a given number of seconds (FOR nexp) or until a given time
  7339. (FOR time). FOR nexp implies 'wait for nexp seconds'. FOR time implies
  7340. 'wait until the system clock reached time', where the time is given in the
  7341. current time format. FOR var/field implies 'wait until a key is pressed,
  7342. and then place it in var or field'. If you follow WAIT with a numeric
  7343. variable or numeric field, it will only accept a number. In other word,
  7344. pressing any key except the keys with the digits 0 to 9, will have no
  7345. effect.
  7346.  
  7347.                 5-157
  7348.  
  7349. EXAMPLES
  7350.  
  7351. 1    WAIT FOR 3
  7352. Waits for 3 seconds.
  7353. 2    WAIT FOR 10:20:30
  7354. Wait until 10:20 am.
  7355. 3    WAIT x$
  7356. Waits for a single key stroke and puts it in x$.
  7357.  
  7358. WHERE
  7359. PURPOSE
  7360. Set the filter conditions for a query or a report.
  7361.  
  7362. SYNTAX
  7363. WHERE conditions
  7364.  
  7365. COMMENTS
  7366.  
  7367. WHERE is the program equivalent of the Filter command line in a query
  7368. definition, and can only be used within a section that is headed by the
  7369. query SELECT command. You can use WHERE to set a filter on the fields
  7370. selected for report output or for other query applications, such as
  7371. sorting, merging files, or simply retrieving data with query that has been
  7372. saved to disk. conditions takes the same form as the Filter command line in
  7373. the query definition dialog (see Chapter 11, Volume 1). WHERE is a
  7374. multi-file filter command - unlike the record selection command SELECT
  7375. WHERE - and if it used for this purpose, the join between two files must be
  7376. placed at the beginning of the statement, as in:
  7377.  
  7378.     WHERE Lastname.Clients=Lastname.Deposits
  7379.  
  7380. Any subsidiary conditions can then be added to the line using the AND
  7381. operator.
  7382.  
  7383. EXAMPLES
  7384.  
  7385. 1    SELECT Firstname.Clients, Lastname.Clients, Bank, Amount
  7386.     WHERE Lastname.Clients=Lastname.Deposits AND
  7387.  
  7388.                 5-158
  7389.  
  7390.     Lastname.Clients LIKE "[d-3]*"
  7391.     ORDER Lastname.Clients
  7392.     END SELECT
  7393. 2    WHERE Price > = 50 AND Price < = 100
  7394. 3    WHERE Lastname LIKE ["a-c"*] AND NOT (Country=USA)
  7395.  
  7396. NOTES
  7397.  
  7398. In the first example, WHERE is used to set up a multi-file filter. It
  7399. selects only those clients whose details are also stored in the Deposits
  7400. file and whose last name initial falls in the range A to C. Note that file
  7401. extension must be given for Lastname since the field occurs in both the
  7402. Clients file and the Deposits file; the Bank and Amount fields do not
  7403. require an extension name since they only occur in the Deposits file. The
  7404. other two examples show WHERE in use as a single file filter command.
  7405.  
  7406.                 5-159
  7407.  
  7408. WHILE WEND
  7409. PURPOSE
  7410. Executes a series of instructions as long as the specified conditions are
  7411. true.
  7412.  
  7413. SYNTAX
  7414. WHILE exp statements WEND
  7415.  
  7416. COMMENTS
  7417.  
  7418. WHILE and WEND set up a loop, in which the statement in between are
  7419. executed repeatedly for as long as the expression following WHILE is true.
  7420. When the expression is not true, execution resumes with the first statement
  7421. after WEND.
  7422.  
  7423. EXAMPLES
  7424.  
  7425. 1    OPEN FILE "Address"
  7426.     SELECT FIRST
  7427.     WHILE NOT EOF ("Address")
  7428.     VIEW
  7429.     SELECT NEXT
  7430.     WEND
  7431. 2    WHILE NOT EOF (*"): INPUT &1, a$:? a$:WEND
  7432.  
  7433. YEAR
  7434. PURPOSE
  7435. Returns a numeric value for the year from a julian date number.
  7436.  
  7437. SYNTAX
  7438. YEAR (nexp)
  7439.  
  7440. COMMENTS
  7441.  
  7442. The function is only valid for dates from 1 January 1 to the end of
  7443. December 9999. Consequently nexpr is only valid in the range 1 to 3652048.
  7444. If nexpr is 0 then the number returned is 0. If nexpr is negative the
  7445. results are unpredictable. Associated date functions are DATE$ DAY DAYS
  7446. DAY$ MONTH
  7447.  
  7448.                 5-160
  7449.  
  7450. EXAMPLES
  7451.  
  7452. 1    numfieldc=YEAR (datefielda)
  7453. 2    numfieldc=YEAR (datefielda + 90)
  7454. 3    numfieldc=YEAR (TODAY)
  7455. 4    x%=YEAR (datefielda + VAL (textfielda))
  7456. 5    x%=YEAR (DAYS ("11 Jan 85")
  7457. 6    ? YEAR (datefielda + 30)
  7458. 7    YEAR (datefielda)=1986
  7459.  
  7460. NOTES
  7461.  
  7462. Example 3 provides a calculation to insert the month number of the system
  7463. date into a numeric field. Example 7 provides a filter to pick out all the
  7464. dates in datefielda which fall in the year 1986.
  7465.  
  7466.                 5-161
  7467.  
  7468.             CHAPTER 6 - QUICK REFERENCE GUIDE
  7469.  
  7470. APPLICATION FUNCTIONS
  7471.  
  7472. RUN [filename]
  7473. Execute program, optionally loading from disk
  7474.  
  7475. CHAIN filename
  7476. Execute program without clearing variables
  7477.  
  7478. NEW [TEXT/QUERY/UPDATE]
  7479. Clear program or text area
  7480.  
  7481. EDIT [TEXT/KEY/QUERY/UPDATE]
  7482. Allow user to edit program, text, query or update
  7483.  
  7484. LOAD [TEXT/KEY/QUERY/UPDATE] filename [, APPEND]
  7485. Load program, text, file, function key list, query or update
  7486.  
  7487. SAVE [TEXT/KEY/QUERY/UPDATE] filename [, TEXT]
  7488. Save program, text file, function key list, query or update
  7489.  
  7490. PROTECT [filename]
  7491. Save the current program in encrypted form
  7492.  
  7493. CALL function
  7494. Call a user supplied function
  7495.  
  7496. SYSTEM COMMANDS
  7497.  
  7498. DEBUG [ON/OFF]
  7499. Set or clear debug flag
  7500.  
  7501. BREAK [ON/OFF]
  7502. Set or clear user stop enabled
  7503.  
  7504. QUIT
  7505. Exit Superbase system
  7506.  
  7507. KEY keynum [, string]
  7508. Set keynum to string or clear it
  7509.  
  7510.                 6-1
  7511.  
  7512. LIST filename
  7513. List any system file to screen
  7514.  
  7515. DELETE filename
  7516. Delete any system file
  7517.  
  7518. RENAME old filename [, TO] new filename
  7519.  
  7520. COPY from filename [, TO] to filename
  7521. Copy any system file
  7522.  
  7523. NUMBASE string
  7524. Set default numeric format
  7525.  
  7526. DATEBASE string
  7527. Set default date format
  7528.  
  7529. DIRECTORY path
  7530. Change directory to path
  7531.  
  7532. SET TABLE/RECORD/FORM
  7533. Set view according to parameter 
  7534.  
  7535. SET PAGING [ON/OFF]
  7536. Set paging
  7537.  
  7538. SET BUFFERS nexp
  7539. Set number of cache buffers to use
  7540.  
  7541. BASIC STATEMENTS
  7542.  
  7543. [LET] var/field=exp
  7544. Assign value of expression to variable or field
  7545.  
  7546. ERASE varlist
  7547. Remove a variable from memory
  7548.  
  7549. CLEAR
  7550. Clear all system variables
  7551.  
  7552. READ var/field [, var/field]
  7553. Read data into variables or fields from data pointer
  7554.  
  7555.                 6-2
  7556.  
  7557. DATA constant [, constant]...
  7558. Specify data for READ statement
  7559.  
  7560. RESTORE [label]
  7561. Move data pointer to specified position or home
  7562.  
  7563. REM text
  7564. Non executable comment line
  7565.  
  7566. EXECUTE string
  7567. Execute text string as though command
  7568.  
  7569. DIM array variable
  7570. Set array dimensions
  7571.  
  7572. CONTROL FLOW
  7573.  
  7574. FOR var=nexp TO nexp [STEP nexp]statements NEXT [var]
  7575. Repeat program lines a number of times
  7576.  
  7577. GOSUB label
  7578. Call a procedure or subroutine
  7579.  
  7580. GOTO label
  7581. Call a procedure or subroutine
  7582.  
  7583. GOTO label
  7584. Branch to the specified label
  7585.  
  7586. ON ERROR [GOTO label]
  7587. Specify procedure to be followed on error condition
  7588.  
  7589. ON nexp GOTO label [, label]...
  7590. Branch to statement or label in list
  7591.  
  7592. ON nexp GOSUB label [, label]...
  7593. Call procedure or subroutine in list
  7594.  
  7595. RETURN
  7596. Return from procedure or subroutine execution
  7597.  
  7598. RESUME [NEXT / label]
  7599. Resume execution after error at next or specified position
  7600.  
  7601. END
  7602. Terminate execution of application
  7603.  
  7604.                 6-3
  7605.  
  7606. WHILE expr
  7607. Perform following commands if expression true
  7608.  
  7609. WEND
  7610. Mark end of while command sequence
  7611.  
  7612. CONDITIONALS
  7613.  
  7614. IF exp THEN statement/label [ELSE statement/label]
  7615. Conditional statement or expression execution
  7616.  
  7617. varfield=exp ? expr:expr
  7618. Conditional assignment of value to field or variable
  7619.  
  7620. FILE AND INDEX COMMANDS
  7621.  
  7622. CREATE sbfname; passwords
  7623. Create a new database file in memory
  7624.  
  7625. CREATE INDEX ON exp [FILE sbfname] [TO index] [UNIQUE]
  7626. Create a new index file optionally make unique
  7627.  
  7628. ADD [FILE sbfname] field definition string [, formula string]
  7629. Add a new field to a file
  7630.  
  7631. MAKE sbfname
  7632. Make the file exist on disk and store the file def
  7633.  
  7634. MODIFY field [, ] field definition string [, formula string]
  7635. Modify parameters for field changing name, type etc.
  7636.  
  7637. SAVE FILE sbfname
  7638. Save the current file definition
  7639.  
  7640. PASSWORD sbfname; passwords
  7641. Set new passwords for a specified file
  7642.  
  7643. REORGANIZE [FILE sbfname] [TO] pathname
  7644. Reorganize current or specified file to new pathname
  7645.  
  7646. OPEN FILE sbfname; passwords
  7647. Open file set as default
  7648.  
  7649.                 6-4
  7650.  
  7651. CLOSE [ALL]/[FILE sbfname]
  7652. Close all or specified files
  7653.  
  7654. FILE sbfname
  7655. Select the default file to be used
  7656.  
  7657. INDEX index
  7658. Select the default index to be used for a file
  7659.  
  7660. REMOVE FILE sbfname
  7661. Remove all data, file and all indices
  7662.  
  7663. REMOVE INDEX index
  7664. Remove the specified index for specified file
  7665.  
  7666. OPEN FIELDS [FILE sbfname] fieldlist
  7667. Open a set of fields for specified file
  7668.  
  7669. CLOSE FIELDS [FILE sbfname]
  7670. Close the open fields for specified file
  7671.  
  7672. RECORD COMMANDS
  7673.  
  7674. BLANK [FILE sbfname]
  7675. Clear all data from current record
  7676.  
  7677. STORE [0/1/2, ] [FILE sbfname]
  7678. Store current record in the file, batch mode optional.
  7679.  
  7680. ENTER [field/nexpr] [, nexpr2]
  7681. Allow the user to enter a record in the current file
  7682.  
  7683. VIEW
  7684. View record in the current file
  7685.  
  7686. SELECT
  7687. Record selection commands
  7688.  
  7689. SELECT FIRST [FILE sbfname] [INDEX index]
  7690. Select the first record in key sequence
  7691.  
  7692. SELECT LAST [FILE sbfname] [INDEX index]
  7693. Select the last record in key sequence
  7694.  
  7695.                 6-5
  7696.  
  7697. SELECT NEXT [FILE sbfname] [INDEX index]
  7698. Select the next record in key sequence
  7699.  
  7700. SELECT PREVIOUS [FILE sbfname] [INDEX index]
  7701. Select the previous record in key sequence
  7702.  
  7703. SELECT CURRENT [FILE sbfname] [INDEX index]
  7704. Select the current record in key sequence
  7705.  
  7706. SELECT DUPLICATE [FILE sbfname] [INDEX index]
  7707. Select the next record with the same key
  7708.  
  7709. SELECT REMOVE [FILE sbfname]
  7710. Remove the current record in selected file
  7711.  
  7712. SELECT KEY string [FILE sbfname] [INDEX index]
  7713. Select the first record with index matching string
  7714.  
  7715. SELECT WHERE [FILE sbfname] [conditions]
  7716. Select the first record matching conditions or clear conditions
  7717.  
  7718. SELECT field parms [WHERE parms] [REPORT parms] [ORDER parms]
  7719. [SAY]/[TO PRINTER/filename/FILE sbfname] [END SELECT]
  7720. Query language command
  7721.  
  7722. PROCESS COMMANDS
  7723.  
  7724. UPDATE calc list [WHERE conditions] [END UPDATE]
  7725. Perform relational update
  7726.  
  7727. REMOVE FROM FILE sbfname WHERE conditions
  7728. Remove records matching conditions
  7729.  
  7730. IMPORT filename [[TO] FILE sbfname] [WHERE conditions] [USING
  7731. parms]
  7732. Import external text file to superbase
  7733.  
  7734. EXPORT [FILE sbfname] [INDEX index] [TO] filename [WHERE
  7735. conditions [USING parms]
  7736. Export to external file
  7737.  
  7738. LABELS [FILE sbfname] [WHERE conditions] [USING labelstring]
  7739. Print labels as per label definition
  7740.  
  7741.                 6-6
  7742.  
  7743. MERGE [TEXT filename [WHERE conditions]
  7744. Load text file and mail merge
  7745.  
  7746. INPUT OUTPUT FUNCTIONS
  7747.  
  7748. SHOW field/strexpr
  7749. Show external field
  7750.  
  7751. OPEN filename FOR INPUT/OUTPUT/APPEND/COMM
  7752. Open sequential file for input/output
  7753.  
  7754. POSITION nexp
  7755. Position in sequential file
  7756.  
  7757. INPUT [&nexp/LINE] var/field
  7758. Input characters or line from text file
  7759.  
  7760. CLOSE INPUT/OUTPUT/COMM
  7761. End input/output to/from text file or comms
  7762.  
  7763. SET filename
  7764. Read exec or variable file and execute
  7765.  
  7766. GET var/field
  7767. Get character from keyboard no wait
  7768.  
  7769. WAIT FOR time/FOR nexp/var/field
  7770. Wait till time, for no of secs or for single key entry
  7771.  
  7772. ASK [string] [pos] [length] ;var/field
  7773. Get input string from user
  7774.  
  7775. BELL
  7776. Ring bell
  7777.  
  7778. HOME
  7779. Move screen output position to home
  7780.  
  7781. CLS
  7782. Clear output screen
  7783.  
  7784. EJECT [nexp]
  7785. Do new pages on print device
  7786.  
  7787.                 6-7
  7788.  
  7789. SCRDUMP
  7790. Do screen dump to printer
  7791.  
  7792. LOCATE coordinates
  7793. Set position on output device
  7794.  
  7795. NEWLINE [nexp]
  7796. Send newline to output device
  7797.  
  7798. MENU column, item, state [, text]
  7799. Set up a user defined menu
  7800.  
  7801. MENU CLEAR
  7802. Clear user-defined menu
  7803.  
  7804. MENU ON numvar
  7805. Turn on user-defined menus, specify variable for return value
  7806.  
  7807. REQUEST text[, ] text[, ] type [, numvar [, textvar [, len]]]
  7808. Set up a user-defined dialog (requester)
  7809.  
  7810. MEMORY
  7811. List of variables in memory
  7812.  
  7813. STATUS [FILE sbfname]
  7814. Status of selected file or system
  7815.  
  7816. SAY [[USING pitch, mode, rate, sex, phonemes] string [, /; string...]]
  7817. Amiga only. Output string as speech
  7818.  
  7819. FG nexp
  7820. Set foreground colour
  7821.  
  7822. BG nexp
  7823. Set background colour
  7824.  
  7825. UL [ON/OFF]
  7826. Set or clear underline
  7827.  
  7828. IT [ON/OFF]
  7829. Set or clear italics
  7830.  
  7831. BF [ON/OFF]
  7832. Set or clear bold face
  7833.  
  7834.                 6-8
  7835.  
  7836. ATTR OFF
  7837. Clear bold face italics and underline
  7838.  
  7839. ? /DISPLAY/PRINT/OUTPUT TO file
  7840. Send information to selected output device
  7841.  
  7842. ? SAY
  7843. Use narrator device to speak output
  7844.  
  7845. ? MEMORY
  7846. List of variables in memory
  7847.  
  7848. ? LIST
  7849. Program listing in memory
  7850.  
  7851. ? STATUS [FILE sbfname]
  7852. Status of selected file or system
  7853.  
  7854. ? DIRECTORY
  7855. Current directory listing
  7856.  
  7857. ? TEXT [MERGE]
  7858. Text file in memory optionally mail merging
  7859.  
  7860. ? QUERY
  7861. Current query statement
  7862.  
  7863. ? exprlist
  7864. Any expression list
  7865.  
  7866. REPORTING
  7867.  
  7868. HEADING statements END HEADING
  7869. Specify statements to execute on page heading
  7870.  
  7871. FOOTING statements END FOOTING
  7872. Specify statements to execute on page footing
  7873.  
  7874. REPORT total list
  7875. Set report totals, means and count
  7876.  
  7877. BEFORE REPORT
  7878. Specify before report activity
  7879.  
  7880.                 6-9
  7881.  
  7882. AFTER REPORT
  7883. Specify after report activity
  7884.  
  7885. END REPORT
  7886. End of report specifications
  7887.  
  7888. GROUP field total list
  7889. Specify subtotal break field and subtotals, means and counts for group
  7890.  
  7891. BEFORE GROUP statements
  7892. Specify before group activity
  7893.  
  7894. AFTER GROUP statements
  7895. Specify after group activity
  7896.  
  7897. END GROUP
  7898. End of group specifications
  7899.  
  7900. FORM HANDLING
  7901.  
  7902. CLOSE FORM
  7903. Close current form
  7904.  
  7905. OPEN FORM formname
  7906. Load a form into memory
  7907.  
  7908. FORM [, page [, row [, column]]]]
  7909. Specify page for current and top left-hand corner
  7910.  
  7911. ENTER [FORM view name] [field list
  7912. Enter data into fields through view form
  7913.  
  7914. OPERATORS
  7915.  
  7916. ARITHMETIC OPERATORS
  7917.  
  7918. ^
  7919. Exponentiation
  7920.  
  7921. -
  7922. Negation
  7923.  
  7924.                 6-10
  7925.  
  7926. *
  7927. Multiplication
  7928.  
  7929. /
  7930. Division
  7931.  
  7932. MOD
  7933. Modulo arithmetic
  7934.  
  7935. +
  7936. Addition
  7937.  
  7938. -
  7939. Subtraction
  7940.  
  7941. RELATIONAL OPERATORS
  7942.  
  7943. =
  7944. Equality
  7945.  
  7946. LIKE
  7947. Pattern matching case insensitive equality
  7948.  
  7949. <>
  7950. Inequality
  7951.  
  7952. <
  7953. Less than
  7954.  
  7955. >
  7956. Greater than
  7957.  
  7958. <=
  7959. Less than or equal to
  7960.  
  7961. >=
  7962. Greater than or equal to
  7963.  
  7964.                 6-11
  7965.  
  7966. LOGICAL OPERATORS
  7967.  
  7968. NOT
  7969.  
  7970. AND
  7971.  
  7972. OR
  7973.  
  7974. MATHEMATICAL FUNCTIONS
  7975.  
  7976. SGN (x)
  7977. Sign of variable
  7978.  
  7979. INT (x)
  7980. Integer portion of variable
  7981.  
  7982. ABS (x)
  7983. Absolute value of variable
  7984.  
  7985. SQR (x)
  7986. Square root
  7987.  
  7988. RND (x)
  7989. Random number
  7990.  
  7991. LOG (x)
  7992. Logarithm
  7993.  
  7994. EXP (x)
  7995. Exponent
  7996.  
  7997. COS (x)
  7998. Cosine
  7999.  
  8000. SIN (x)
  8001. Sine
  8002.  
  8003. TAN (x)
  8004. Tangent
  8005.  
  8006. ATN (x)
  8007. Arctangent
  8008.  
  8009. FIX (x, y)
  8010. Fix decimal precision of value
  8011.  
  8012.                 6-12
  8013.  
  8014. FREE (n)
  8015. Return free memory size
  8016.  
  8017. DISKSPACE ("disk")
  8018. Return free disk space
  8019.  
  8020. RECCOUNT (sbfname)
  8021. Return number of records in file
  8022.  
  8023. SER (sbfname)
  8024. Return serial number of specified file
  8025.  
  8026. ROW (0)
  8027. Return current screen row
  8028.  
  8029. COL (0)
  8030. Return current screen column
  8031.  
  8032. PROW (n)
  8033. Return current printer row
  8034.  
  8035. PCOL (n)
  8036. Return current printer column
  8037.  
  8038. EOF (sbfname)
  8039. Return if at end of file
  8040.  
  8041. FOUND (sbfname)
  8042. Return result of last search
  8043.  
  8044. LOOKUP (value, fld)
  8045. Return if value exists in file (indexed field)
  8046.  
  8047. STRING FUNCTIONS
  8048.  
  8049. LEN (x$)
  8050. Length of string
  8051.  
  8052. STR$ (x[[, y] [, z] / [, numformat]])
  8053. String from number with optional format
  8054.  
  8055. VAL (x$)
  8056. Value of string
  8057.  
  8058.                 6-13
  8059.  
  8060. ASC (x$)
  8061. Ascii value of character
  8062.  
  8063. CHR$ (x$)
  8064. String value of character
  8065.  
  8066. LEFT$ (x$, nexp)
  8067. Left portion of string
  8068.  
  8069. RIGHT$ (x$, nexp)
  8070. Right portion of string
  8071.  
  8072. MID$ (x$, nexp [, nexp])
  8073. Mid portion of string
  8074.  
  8075. DAYS (x$)
  8076. Numeric value of date
  8077.  
  8078. DATE$ (nexp [, dform])
  8079. Date string from numeric using optional format
  8080.  
  8081. DAY (date)
  8082. Numeric day value of date
  8083.  
  8084. DAY$ (date)
  8085. Day of week from date
  8086.  
  8087. MONTH (date)
  8088. Numeric month value of date
  8089.  
  8090. MONTH$ (date)
  8091. Month string from date
  8092.  
  8093. YEAR (date)
  8094. Numeric year value of date
  8095.  
  8096. TIMEVAL (time)
  8097. Numeric value of time
  8098.  
  8099. TIME$ (nexp [, tformat])
  8100. Time string from numeric using optional time format
  8101.  
  8102. HRS (time)
  8103. Number of hours from time
  8104.  
  8105.                 6-14
  8106.  
  8107. MINS (time)
  8108. Number of minutes from time
  8109.  
  8110. SECS (time)
  8111. Number of seconds from time
  8112.  
  8113. THOUSECS (time)
  8114. Number of thousandths of second from time
  8115.  
  8116. LCASE$ (x$)
  8117. Convert string to lower case
  8118.  
  8119. UCASE$ (x$)
  8120. Convert string to upper case
  8121.  
  8122. FCASE$ (x$)
  8123. Capitalize first letter of string
  8124.  
  8125. TRIM$ (x$)
  8126. Trim trailing spaces from x$
  8127.  
  8128. LTRIM$ (x$)
  8129. Trim leading spaces from x$
  8130.  
  8131. INSTR ([n, ]x$, y$)
  8132. Find position of substring y$ in x$
  8133.  
  8134. REPLICATE (x$, nexp)
  8135. Replicate character expression n times
  8136.  
  8137. SPACES$ (n)
  8138. Return string with n spaces
  8139.  
  8140. ERR$ (n)
  8141. Returns error message for error number n
  8142.  
  8143. VARIABLES
  8144.  
  8145. TODAY
  8146. Return system date
  8147.  
  8148. NOW
  8149. Return system time
  8150.  
  8151.                 6-15
  8152.  
  8153. ERRNO
  8154. Return current error number
  8155.  
  8156. PI
  8157. Return value of pi
  8158.  
  8159. FIELDS BY NAME
  8160. Fieldname; Field.file; Field. "file"
  8161.  
  8162. MULTIPLE RESPONSE FIELDS
  8163. Fieldname (nexp)
  8164.  
  8165. STRING VARIABLES
  8166. X$
  8167.  
  8168. NUMERIC VARIABLES
  8169. X%
  8170.  
  8171. ARRAYS
  8172. X% or X$ (nexp[[, nexp] [, nexp]])
  8173.  
  8174.                 6-16
  8175.  
  8176.                    INDEX
  8177.  
  8178. & 5-4                        C
  8179. ? 5-8                        Changing the output device
  8180.                         5-3
  8181. ? Commands 5-3                    Command line 3-6
  8182. ? DIRECTORY 5-9                       Editing 3-7
  8183. ? LIST 5-9                    Constants 2-13
  8184. ? MEMORY 5-10                    CONTAINS 2-11
  8185. ? QUERY 5-10
  8186. ? STATUS 5-11                    D
  8187. ? STATUS FILE 5-11                DATA 5-33, 5-116
  8188. ? TEXT 5-12                    Date 2-6
  8189. @ 5-4                        Date format 2-6
  8190.                         DATE$ 5-34
  8191. A                        DATEBASE 5-35
  8192. ABS 5-13                    DAY 5-36
  8193. ADD 5-14                    DAY$ 5-37
  8194. AFTER GROUP 5-17                DAYS 5-38
  8195. AFTER REPORT 5-18                DELETE 5-39
  8196. APPEND 5-83, 5-103                DESCENDING 5-106
  8197. Arithmetic operators 2-7            DIRECTORY 5-40
  8198. Arrays 2-4                      See ? DIRECTORY
  8199. ASC 5-18                    DISKSPACE 5-41
  8200. ASCENDING 5-106                    DOWN 5-4
  8201. ASK 5-19
  8202. ATN 5-20                    E
  8203. ATTR 5-4                    EDIT 5-42
  8204.                         Editing keys
  8205. B                          Command line 3-7
  8206. Batch mode 5-148                  Program 3-5
  8207. BEFORE GROUP 5-21                EJECT 5-43
  8208. BELL 5-22                    END 5-44
  8209. BF 5-4                        END GROUP 5-44
  8210. BG 5-4                        END HEADING 5-45
  8211. BLANK 5-22                    END REPORT 5-45
  8212. BREAK ON/OFF 5-23                EOF 5-48
  8213.                         ERASE 5-49
  8214.  
  8215.   PAGING 5-144                    TO FILE 5-141
  8216.   RECORD 5-145                    TO PRT 5-141
  8217.   TABLE 5-145                    TODAY 5-153
  8218.   View mode 5-145                TRIM$ 5-154
  8219. SGN 5-145
  8220. SHOW 5-146                    U
  8221. SIN 5-147                    UCASE$ 5-154
  8222. Sorting data 5-106                UL 5-4
  8223. SPACE$ 5-147                    Update 5-155
  8224. SQR 5-148                      Load 5-83
  8225. Start up program 3-9                  Save 5-130
  8226. STATUS
  8227.   See ? STATUS                    V
  8228. STORE 5-148                    VAL 5-156
  8229. STR$ 5-150                    Variables 2-2
  8230. String variables 2-4                  Arrays 2-4
  8231. Syntax 2-15                      Names 2-2
  8232. System status 5-11                  Numeric 2-3
  8233. System variables 2-4                  String 2-4
  8234.                           System 2-4
  8235. T                        VIEW 5-157
  8236. TAN 5-151
  8237. Ternary operator 5-81                W
  8238. Text                        WAIT 5-157
  8239.   Load 5-83                    WEND 5-160
  8240.   Outputting files 5-12                WHERE 5-158
  8241.   Save 5-130                    WHILE 5-160
  8242. THOUSECS 5-151
  8243. Time 2-6                    Y
  8244. TIME$ 5-152                    YEAR 5-160
  8245. TIMEVAL 5-152
  8246.  
  8247. ============================================================================
  8248.      DOCS PROVIDED BY RAP AND -+*+-THE SOUTHERN STAR-+*+- for M.A.A.D.                                                               
  8249. ============================================================================
  8250.